Read and write to interactive map layers using the OLP CLI

Objectives: Interactive map layers allow real-time live interaction with location data at the feature level.

Complexity: Beginner

Time to complete: 30 min

Prerequisites: Organize your work in projects

Source code: Download

The purpose of this tutorial is to provide basic guidance on how to create and manage data in the interactive map layers.

This tutorial includes the following steps:

  1. Create an interactive map layer.
  2. Manage data in an interactive map layer.

As a preparation step, you must create your catalog with an interactive map layer type.

One unique characteristic of an interactive map layer is that it allows interaction with the data at the map feature level, which is more granular, unlike other layer types where users interact with partitions.

Creating a catalog with an interactive map layer

You can create an interactive map layer using the following snippet.

Create a file called interactivemap-catalog.json with the contents below, replacing it with an identifier of your choice.

{
  "id": "{{YOUR_CATALOG_ID}}",
  "name": "Interactive Map layer tutorial",
  "summary": "Interactive Map layer tutorial",
  "description": "Interactive Map layer tutorial",
  "tags": ["Interactive Map Layer"],
  "layers": [
    {
      "id": "iml1",
      "name": "My interactive map layer ",
      "summary": "My interactive map layer ",
      "description": "My interactive map layer ",
      "layerType": "interactivemap",
      "tags": ["Interactive Map Layer"],
      "volume": {
        "volumeType": "durable"
      },
      "contentType":"application/geo+json",
      "partitioning": {
        "scheme":"generic"
      },
      "interactiveMapProperties": {
          "searchableProperties": [
          "description","title","lines"
        ]
      }
    }
  ]
}

Replace the following with your own identifier and then run the following command:

olp catalog create {{YOUR_CATALOG_ID}} \
    "Interactive Map layer tutorial" \
    --config iml_catalog.json

Note

If a billing tag is required in your realm, update the config file by adding the billingTags: ["YOUR_BILLING_TAG"] property to the layer section.

Manage data in an interactive map layer using the OLP CLI

Put data

You can upload a single file from your local file system to an interactive map layer using the OLP Command Line Interface (CLI). Run the following command using the catalog HRN you received when you created your catalog.

olp catalog layer feature put {{YOUR_CATALOG_HRN}} iml1 --data demoData.geojson

Get data

You can fetch the data from an interactive map layer by using this command. By default, the command output is displayed on the terminal output in tabular format. This command has several different options which you can use to fetch the data. Run the following command using the catalog HRN you received when you created your catalog.

olp catalog layer feature list {{YOUR_CATALOG_HRN}} iml1

Get contents of an uploaded file

You can fetch the sample data of the layer and view it in the terminal. It displays features in the terminal. Run the following command using the catalog HRN you received when you created your catalog.

olp catalog layer feature get {{YOUR_CATALOG_HRN}} iml1

Delete data

You can delete features inside an interactive map layer by using this command. Run the following command using the catalog HRN you received when you created your catalog.

olp catalog layer feature delete {{YOUR_CATALOG_HRN}} iml1 --ids 1 2

Further information

For additional details on the topics covered in this tutorial, you can refer to the following sources:

results matching ""

    No results matching ""