Is it possible to use maphub api to upload lines from specific document and visualize in maphub?

I am trying to use maphub Api to visualize data as markers and lines. By following the guide from adding markers and image, markers are successfully uploaded. However, I cannot find a way to visualize lines in maphub. By providing Json file with a set of coordinates, is it possible to visualize a line in maphub just like the picture below by using python from the below link? The line below is draw from me, but the final goad is to upload a line following the coordinates provided from the json file.

The link below is the coordinates of the line from a bus route that retrieved from government, which I want to use as reference.

api.csdi.gov.hk/apim/dataquery/api/?id=td_rcd_1638844988873_41214&layer=fb_route_line&bbox-crs=WGS84&bbox=113.8,22.1,114.7,23.0&limit=10&offset=0&ROUTE_NAMEE=219X

1 Like

Hi and Welcome to the forum!

Yes, of course you can visualize any kind of data via the API. The best way to understand what format is needed, do the following:

  1. Make a new map, draw a very simple version of what you’d like to understand, for example a single line. Change the text, description, color for example.

  2. Save and click Download and select MapHub GeoJSON.

  3. Look at the downloaded file with a text editor which can display the JSON in a clean way. For example, paste it to https://www.jsonformatter.io/

As an example, I created the following map:

It looks like this:

And this is the GeoJSON for it:

{
  "type": "FeatureCollection",
  "features":
  [
    {
      "type": "Feature",
      "id": 3276068295,
      "geometry":
      {
        "type": "LineString",
        "coordinates":
        [
          [
            -64.071831,
            35.827226
          ],
          [
            -53.546358,
            22.673397
          ],
          [
            -29.535123,
            23.430033
          ],
          [
            -16.049361,
            37.671912
          ]
        ]
      },
      "properties":
      {
        "stroke": "#cc1b15",
        "description": "Description of the sample line.",
        "title": "Sample line"
      }
    }
  ],
  "groups":
  [],
  "markers":
  [],
  "properties":
  {}
}
1 Like