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: Easy

Time to complete: 30 min

Dependencies: Organize your work in projects

Source code: Download

The purpose of the 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 will need to create your catalog with an interactive map layer type.

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

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

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

Check out the following links for more information about topics covered in this tutorial:

results matching ""

    No results matching ""