# Map API

A map contains the following fields:

name type description
uid string Unique ID.
map_name float name of the map
map_version int version of the map
create_time int Unix timestamp, like 1644568815
grid_origin_x float X coordinate of the lower-left corner
grid_origin_y float Y coordinate of the lower-left corner
grid_resolution float the size of a single pixel. Typically 0.05(m/pixel)
overlays_version int overlays version
overlays string Overlays in GeoJson Format. Contains POIs/virtual walls etc.
carto_map string base64 encoded binary map data(for positioning)
occupancy_grid string base64 encoded PNG image data(for display)

# Map List

curl http://192.168.25.25:8090/maps/
[
  {
    "id": 1,
    "uid": "620620f9c0fd0ecb0f66d981",
    "map_name": "5层地图",
    "create_time": 1644568815,
    "map_version": 9,
    "overlays_version": 14,
    "thumbnail_url": "http://192.168.25.25:8090/maps/1/thumbnail",
    "image_url": "http://192.168.25.25:8090/maps/1.png",
    "url": "http://192.168.25.25:8090/maps/1"
  },
  {
    "id": 2,
    "uid": "61ee4c3ac0fd0ecb0f66d165",
    "map_name": "前台大厅",
    "create_time": 1643007028,
    "map_version": 2,
    "overlays_version": 8,
    "thumbnail_url": "http://192.168.25.25:8090/maps/2/thumbnail",
    "image_url": "http://192.168.25.25:8090/maps/2.png",
    "url": "http://192.168.25.25:8090/maps/2"
  },
  {
    "id": 3,
    "uid": "61e95264c0fd0ecb0f66c71e",
    "map_name": "楼道大图",
    "create_time": 1642680851,
    "map_version": 1,
    "overlays_version": 3,
    "thumbnail_url": "http://192.168.25.25:8090/maps/3/thumbnail",
    "image_url": "http://192.168.25.25:8090/maps/3.png",
    "url": "http://192.168.25.25:8090/maps/3"
  }
]

Extra Fields

name description
image_url The image(PNG) representation of the map, in original resolution
thumbnail_url The image(PNG) representation of the map, in low resolution

# Get Map Detail

curl http://192.168.25.25:8090/maps/1
{
  "id": 1,
  "map_name": "5层地图",
  "uid": "620620f9c0fd0ecb0f66d981",
  "map_version": 9,
  "create_time": 1644568815,
  "last_modified_time": 1647333821,
  "grid_origin_x": -53.1968,
  "grid_origin_y": -25.0135,
  "grid_resolution": 0.05,
  "overlays_version": 14,
  "overlays": "{\"type\": \"FeatureCollection\", \"features\": [{\"id\": ...",
  "thumbnail_url": "http://192.168.25.25:8090/maps/1/thumbnail",
  "image_url": "http://192.168.25.25:8090/maps/1.png",
  "pbstream_url": "http://192.168.25.25:8090/maps/1.pbstream"
}

Extra Fields

name description
image_url URL to get the image(PNG) of the map, in original resolution.
thumbnail_url URL to get the thumbnail(PNG) image of the map
pbstream_url URL to get the data of the map. Binary.

# Create a Map

A map can be created, by providing needed fields:

  • map_name
  • carto_map
  • occupancy_grid
  • grid_origin_x
  • grid_origin_y
  • grid_resolution
  • overlays_version (optional)
  • overlays (optional)
  • uid (optional)
  • map_version (optional)
curl -X POST \
    -H "Content-Type: application/json" \
    --data '{"map_name": "xxx", "carto_map": "xxxx", "occupancy_grid": "xxx" ...}' \
    http://192.168.25.25:8090/maps/

Response

{
  "id": 119, // The newly created map id. Use this id to load it into robot.
  "uid": "9b94ac16-239b-11ed-9446-1e49da274768",
  "map_name": "From Mapping 4",
  "create_time": 1657015615,
  "map_version": 1,
  "overlays_version": 1,
  "thumbnail_url": "http://192.168.25.25:8090/maps/119/thumbnail",
  "image_url": "http://192.168.25.25:8090/maps/119.png",
  "url": "http://192.168.25.25:8090/maps/119"
}

# Modify Map

Modify the name and overlays

curl -X PATCH \
    -H "Content-Type: application/json" \
    -d '{"map_name": "...", "overlays": "..."}' \
    http://192.168.25.25:8090/maps/1 {}

# Delete Map

curl -X DELETE http://192.168.25.25:8090/maps/1

# Delete All Maps

curl -X DELETE http://192.168.25.25:8090/maps
Last Updated: 10/30/2024, 8:40:52 PM