5 minutes to help shape OpenTodo. Anonymous, no account. Take the survey

Maps API

The server proxies the map provider for the web app's maps and place search (guide: locations and places), so a browser never contacts a third party.

Implementation notes

The server proxies the map provider for the web app's maps and place search (guide: locations and places), so a browser never contacts a third party. The routes need a session or a full or admin token; with maps off they answer 404 maps_disabled, and when the provider does not answer 502 maps_unavailable. A demo instance has maps off unless OPENTODO_MAPS=on.

GET /api/v1/maps/fonts/{fontstack}/{range}

Get a maps font · Token or session

the glyphs of a font range (.pbf optional)

Refuses read and agent tokens.

Path parameters
FieldTypeDescription
fontstack requiredstringpath
range requiredstringpath

Response 200: OK

GET /api/v1/maps/reverse

Get maps reverse · Token or session

?lat=…&lon=…&lang=en → {result: {name, address, lat, lon}}

Refuses read and agent tokens.

Response 200
FieldTypeDescription
result requiredobject | null
result.address requiredstring
result.lat requirednumber
result.lon requirednumber
result.name requiredstring

GET /api/v1/maps/sprites/{file}

Get a maps sprite · Token or session

the style's sprite sheet (.png) or its index (.json)

Refuses read and agent tokens.

Path parameters
FieldTypeDescription
file requiredstringpath

Response 200: OK

GET /api/v1/maps/style

Get maps style · Token or session

the provider's style, rewritten to point at the routes below (cached for an hour)

Refuses read and agent tokens.

Response 200: OK

GET /api/v1/maps/tiles/{z}/{x}/{y}

Get a maps tile · Token or session

one vector tile (.pbf optional), cached on the server under <data>/cache/maps and in the browser for a day

Refuses read and agent tokens.

Path parameters
FieldTypeDescription
z requiredstringpath
x requiredstringpath
y requiredstringpath

Response 200: OK

GET /api/v1/pages/{secret}/maps/style

Get page maps style · No authentication

No authentication.

Path parameters
FieldTypeDescription
secret requiredstringpath

Response 200: OK

GET /api/v1/settings/maps

List settings maps · Token or session

{enabled, tiles_url, geocoder_url, locked, defaults: {tiles_url, geocoder_url}}; PUT {enabled, tiles_url?, geocoder_url?} (empty URLs use the defaults). A value set by OPENTODO_MAPS* is listed in locked and cannot be changed. Changes are audited as settings.changed (maps.enabled, maps.tiles_url, maps.geocoder_url); refused on a demo

Only the server's owner.

Response 200
FieldTypeDescription
defaults requiredobject
defaults.geocoder_url requiredstring
defaults.tiles_url requiredstring
enabled requiredboolean
geocoder_url requiredstring
locked requiredarray of string
tiles_url requiredstring

PUT /api/v1/settings/maps

Update settings maps · Token or session

{enabled, tiles_url, geocoder_url, locked, defaults: {tiles_url, geocoder_url}}; PUT {enabled, tiles_url?, geocoder_url?} (empty URLs use the defaults). A value set by OPENTODO_MAPS* is listed in locked and cannot be changed. Changes are audited as settings.changed (maps.enabled, maps.tiles_url, maps.geocoder_url); refused on a demo

Only the server's owner. Needs a session or an admin token; full tokens are refused.

Request body
FieldTypeDescription
enabledboolean | null
geocoder_urlstring | null
tiles_urlstring | null
Response 200
FieldTypeDescription
defaults requiredobject
defaults.geocoder_url requiredstring
defaults.tiles_url requiredstring
enabled requiredboolean
geocoder_url requiredstring
locked requiredarray of string
tiles_url requiredstring

This group in the HTTP API guide