Skip to Content
truemetrics Docs

1 · In your own map

Examples

Example calls and responses.

The base URL and your x-api-key are provided by your truemetrics contact. The examples below use https://geodata.truemetrics.cloud/V1 and YOUR_API_KEY as placeholders, and …ADDRESS_ID placeholders for the address identifiers you send as metadata.

1. A stop where entrance and parking share one identifier

The most common case: one address identifier holds both the entrance and the parking. Pass it to both parameters, and add geojson=true to get the features.

Example Request
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&geojson=true' \
--header 'x-api-key: YOUR_API_KEY'
Response
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": { "type": "Point", "coordinates": [18.838413, 50.251602] },
      "properties": { "object_type": "point", "point_type": "entrance", "identifier": "ADDRESS_ID",
                      "color": "#E63946", "marker_size": 8, "icon": "entrance" }
    },
    {
      "type": "Feature",
      "geometry": { "type": "Point", "coordinates": [18.838083, 50.251618] },
      "properties": { "object_type": "point", "point_type": "parking", "identifier": "ADDRESS_ID",
                      "color": "#1E9ED5", "marker_size": 8, "icon": "parking" }
    },
    {
      "type": "Feature",
      "geometry": { "type": "Point", "coordinates": [18.837992, 50.251594] },
      "properties": { "object_type": "point", "point_type": "waypoint", "identifier": "ADDRESS_ID",
                      "color": "#1E9ED5", "marker_size": 6, "icon": "waypoint" }
    },
    {
      "type": "Feature",
      "geometry": { "type": "LineString", "coordinates": [[18.838083,50.251618],[18.838158,50.251655],[18.838301,50.251648],[18.838413,50.251602]] },
      "properties": { "object_type": "line", "line_type": "parking_to_entrance", "identifier": "ADDRESS_ID", "path_source": "legs",
                      "color": "#1E9ED5", "line_width": 3, "line_style": "dashed", "line_dasharray": [2,2], "line_opacity": 0.6 }
    },
    {
      "type": "Feature",
      "geometry": { "type": "LineString", "coordinates": [[18.837992,50.251594],[18.838041,50.251611],[18.838083,50.251618]] },
      "properties": { "object_type": "line", "line_type": "waypoint_to_parking", "identifier": "ADDRESS_ID", "path_source": "legs",
                      "color": "#1E9ED5", "line_width": 3 }
    }
  ],
  "metadata": { "mode": "default", "system": "EPSG:4326", "waypoint_style": "marker" },
  "view": { "center": { "lat": 50.2516245, "lon": 18.8382025 }, "zoom": 18,
            "orientation": 0, "position_fixed": true, "zoomable": false }
}

When the entrance is matched to a building, a polygon feature (point_type: "building") is also included and drawn beneath the markers, and view covers it too.

2. Entrance and parking under different identifiers

If your entrance and parking live under separate address IDs, pass each to its own parameter. They are joined into one stop and connected by the dashed walking path.

Example Request
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ENTRANCE_ADDRESS_ID&identifier_parking=PARKING_ADDRESS_ID&geojson=true' \
--header 'x-api-key: YOUR_API_KEY'

3. Rendered image, transparent

Add raster=true to receive a PNG. Without geojson=true the features stay out and the answer stays small. With no basemap the image has a transparent background. Its size is set with width and height (default 640 × 480).

Example Request
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&raster=true' \
--header 'x-api-key: YOUR_API_KEY'
Response (truncated)
{
  "type": "FeatureCollection",
  "features": [],
  "metadata": { "mode": "default", "system": "EPSG:4326", "waypoint_style": "faded" },
  "view": { "center": { "lat": 50.2516245, "lon": 18.8382025 }, "zoom": 18, "orientation": 0, "position_fixed": true, "zoomable": false },
  "raster": {
    "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…",
    "width": 640,
    "height": 480,
    "bbox": [18.837992, 50.251594, 18.838413, 50.251655],
    "basemap": false
  }
}

The images on this page come from an account with waypoint_style: "faded": no waypoint marker, and the approach line fades out toward the waypoint. With "marker" the PNG draws a blue W at the start of a solid line. The GeoJSON contains the waypoint either way. bbox is not the extent of the image; see the rendered image.

4. Rendered image on a street basemap

Add basemap=true to draw the geometry on a street basemap. The image carries the Mapbox logo and ”© Mapbox © OpenStreetMap”; keep both visible where you show it.

Example Request
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&raster=true&basemap=true' \
--header 'x-api-key: YOUR_API_KEY'

5. Turning the image into a file

The raster.image value is a base64 data-URI. To save it as a PNG:

Save the PNG
curl -s --header 'x-api-key: YOUR_API_KEY' \
  'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&raster=true&basemap=true' \
| python -c "import sys,json,base64; d=json.load(sys.stdin); open('lastmeter.png','wb').write(base64.b64decode(d['raster']['image'].split(',',1)[1]))"

6. Toggling the building highlight and the reference point

The building footprint is included by default. Pass building=false to leave it out:

Without the building highlight
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&geojson=true&building=false' \
--header 'x-api-key: YOUR_API_KEY'

If reference points are enabled for your account (on request) and you send a reference location in your metadata, add reference=true to also plot it as a small red taskpoint, to compare the planned location with the learned entrance:

With the reference point
curl --location 'https://geodata.truemetrics.cloud/V1/lastmetervisualization?identifier_entrance=ADDRESS_ID&identifier_parking=ADDRESS_ID&geojson=true&reference=true' \
--header 'x-api-key: YOUR_API_KEY'
The extra feature
{
  "type": "Feature",
  "geometry": { "type": "Point", "coordinates": [18.838450, 50.251560] },
  "properties": { "object_type": "point", "point_type": "taskpoint", "identifier": "ADDRESS_ID",
                  "color": "#E63946", "marker_size": 4 }
}

The reference point appears as a small red dot next to the learned entrance. Here the planned location sits a few metres from the entrance couriers actually use:

With geojson=true, an empty features array means the stop has no data yet: still a 200, with view: null and no raster. New deliveries count after the next nightly merge run. Without geojson=true, features is always empty.