Skip to Content
truemetrics Docs

1 · In your own map

API Reference

Endpoint, parameters and response contract.

Endpoint

GET https://geodata.truemetrics.cloud/V1/lastmetervisualization

Returns a GeoJSON FeatureCollection for one stop, optionally with a rendered PNG. The data is the last meter learned for the stop’s address identifiers, merged from all deliveries there; new deliveries count after the next nightly merge run. The base URL is provided by your truemetrics contact.

Request

Query parameters

A request describes a single stop, addressed by up to two address identifiers: the entrance and the parking. They may be the same identifier (one address that has both) or two different identifiers (many systems store the entrance and parking under separate address IDs). At least one of them must be provided, each at most 256 characters long.

identifier_entrancestring

The address identifier (the id_address / merge id you send as metadata) used to look up the entrance and its building footprint. Optional, but at least one of identifier_entrance / identifier_parking is required.

identifier_parkingstring

The address identifier used to look up the parking and the waypoint (these two share the same ID). Optional, but at least one of identifier_entrance / identifier_parking is required.

rasterbooleandefault:"false"

When true, the response also contains a rendered PNG image of the geometry in a raster block. Accepted truthy values: true, 1, yes, on.

widthintegerdefault:"640"

Width of the PNG in pixels, from 64 to 1280. Values outside are clamped; a value that is not a number falls back to the default.

heightintegerdefault:"480"

Height of the PNG in pixels, from 64 to 1280, handled like width.

basemapbooleandefault:"false"

Only relevant together with raster=true. When true, the PNG is drawn on a street basemap (see the rendered image for attribution); when false the PNG has a transparent background.

buildingbooleandefault:"true"

Draw the snapped building footprint highlight under the entrance. On by default; pass building=false to leave it out.

geojsonbooleandefault:"false"

Include the GeoJSON features array in the response. Off by default; pass geojson=true to receive the vector geometry. The type / metadata / view envelope (and the raster block, when requested) is always returned, so if you only need the rendered image you can request raster=true alone and keep the payload small.

referencebooleandefault:"false"

When true, also plot your reference location (“taskpoint”, the referenceLatitude / referenceLongitude you send in metadata) as a small red point, so you can compare the planned location against the learned entrance. Enabled per account on request (info@truemetrics.io); for other accounts the parameter has no effect.

Headers

x-api-keystringrequired

Your API key. Identifies your account; you only receive your own data. See API keys.

Response

A standard GeoJSON FeatureCollection with two extra top-level blocks, metadata and view (and raster when requested).

typestring

Always "FeatureCollection".

featuresarray

The map features; see Feature types below. Returned only when geojson=true (off by default); otherwise it is an empty array. Even with geojson=true it may be empty when the stop has no data yet (a normal 200, not an error).

metadataobject

{ "mode": "default", "system": "EPSG:4326", "waypoint_style": "marker" }: the coordinate reference system of all geometry, and how the PNG draws the waypoint, set per account: "marker" (a waypoint marker at the start of a solid waypoint_to_parking line) or "faded" (no waypoint marker; the waypoint_to_parking line fades out toward the waypoint, see line_fade). features contains the waypoint point either way; for your own map, take the value as a hint.

viewobject | null

A suggested camera fitted to every point, path vertex and building corner: { center: { lat, lon }, zoom, orientation, position_fixed, zoomable }, with center the middle of that box and zoom a whole number from 1 to 18. null when the stop has no data.

rasterobject

Present only when raster=true and the stop has data (with or without geojson=true): { image, width, height, bbox, basemap }, where image is a data:image/png;base64,… data-URI, width and height are its size in pixels, bbox is [minLon, minLat, maxLon, maxLat] of the points and line vertices (not of the image), and basemap is true when a street basemap was asked for and is available. See the rendered image.

The rendered image

Fit. The image is centred on the middle of bbox. bbox covers the points (including the waypoint and taskpoint) and the line vertices, not the building polygon, which can reach past the edge of the image. The geometry is scaled to fill 64 % of the width or of the height, whichever is tighter, so at least 18 % of the image stays clear on each side of the tighter axis and more on the other:

  • Transparent (basemap=false): a flat projection with the same scale in metres on both axes, at most 8 pixels per metre, so a very small stop stays smaller in the middle.
  • Basemap (basemap=true): Web Mercator at the (fractional) zoom that gives this fit, at most zoom 22; a stop that is a single point is shown at zoom 18.

bbox is therefore not the extent of the image: used as the image’s bounds, it misplaces the image. For a map of your own, draw the GeoJSON.

Attribution. The basemap comes from Mapbox (streets-v12) and carries the Mapbox logo and ”© Mapbox © OpenStreetMap” in its corners. Keep both visible wherever you show the image; do not crop or cover them.

Fallbacks. Both come back as a 200:

  • If the basemap cannot be fetched, the image is drawn transparent with the transparent fit, while basemap still says true. A transparent corner pixel tells the two apart.
  • If the image cannot be rendered, the answer has no raster block; the rest is as requested.

Feature types

Every feature carries properties.object_type (point | line | polygon), the identifier it came from, and styling hints that map directly to map layer styles.

Point: entrance, parking, waypoint

PropertyTypeDescription
object_typestring"point"
point_typestringentrance · parking · waypoint · taskpoint (your reference location, only with reference=true)
colorstringMarker colour (red entrance, blue parking/waypoint, red taskpoint) → circle-color
marker_sizenumberMarker radius → circle-radius (the taskpoint is a small dot)
iconstringIcon name for the marker (absent for the taskpoint, which is a plain dot)

Line: walk path and approach

Lines are the paths the nightly merge stores, routed over the couriers’ recorded tracks: on foot for parking_to_entrance, driving for waypoint_to_parking. They can contain many vertices and are never computed at request time. When no path could be routed for a pair, no line is returned. Coordinates are ordered source→target (the direction in line_type).

PropertyTypeDescription
object_typestring"line"
line_typestringparking_to_entrance (the dashed walking path) · waypoint_to_parking (the driven approach from the waypoint to the parking)
path_sourcestring"legs": routed over the recorded tracks. "straight": legacy, a direct source→target segment stored by older runs. A pair the merge could not route is stored as "none" and returns no line.
colorstringLine colour → line-color
line_widthnumberLine width → line-width
line_stylestring"dashed" for the walking path; combine with line_dasharray (e.g. [2,2])
line_opacitynumberOpacity of the walking path (e.g. 0.6) → line-opacity
line_fade / fade_startstring / numberOnly with waypoint_style: "faded": waypoint_to_parking fades toward the waypoint: line_fade: "to_start", transparent at the start of the line, full opacity from fade_start (e.g. 0.3) onward. Render with a line-gradient

Paths are raw GPS-routed vertices. Render them with line-join: "round" and line-cap: "round" for smooth corners; the PNG from raster=true already rounds them.

Polygon: building footprint

PropertyTypeDescription
object_typestring"polygon"
point_typestring"building"
colorstringFill / outline colour
fill_opacitynumberFill opacity (e.g. 0.2) → fill-opacity
line_widthnumberOutline width

The entrance and parking can come from different identifiers. Pass each to its own parameter (identifier_entrance / identifier_parking) and they are joined into one stop: the dashed walking path connects them and, when available, the entrance’s building is highlighted.

Status codes

StatusMeaning
200Success. features is empty unless geojson=true; with geojson=true, an empty features array means the stop has no data yet.
400Neither identifier_entrance nor identifier_parking was provided, or one is longer than 256 characters.
403Missing or invalid x-api-key, or the key is not enabled for this API (API keys).
429Too many requests for your API key. Slow down and retry with a growing delay.
500Internal error. Retry later; if it persists, write to info@truemetrics.io.

Caching & limits

  • Answers with data are cached for an hour, on our side and by Cache-Control: public, max-age=3600. Answers without data are not cached, so a stop shows up as soon as the merge has it.
  • CORS is open (Access-Control-Allow-Origin: *) so the endpoint can be called from the browser.
  • Limits apply per API key; a 429 means slow down.

On this page