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
/api/v1/maps/reverse - GET
/api/v1/maps/search - GET
/api/v1/maps/sprites/{file} - GET
/api/v1/maps/style - GET
/api/v1/maps/tiles/{z}/{x}/{y} - GET
/api/v1/pages/{secret}/maps/style - GET
/api/v1/settings/maps - PUT
/api/v1/settings/maps
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.
| Field | Type | Description |
|---|---|---|
fontstack required | string | path |
range required | string | path |
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.
| Field | Type | Description |
|---|---|---|
result required | object | null | |
result.address required | string | |
result.lat required | number | |
result.lon required | number | |
result.name required | string |
GET /api/v1/maps/search
Get maps search · Token or session
?q=…&lang=en&limit=5 (1–10) → {results: [{name, address, lat, lon}]}; 30 searches a minute per account with /reverse (429 rate_limited)
Refuses read and agent tokens.
| Field | Type | Description |
|---|---|---|
results required | array of object | |
results[].address required | string | |
results[].lat required | number | |
results[].lon required | number | |
results[].name required | string |
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.
| Field | Type | Description |
|---|---|---|
file required | string | path |
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.
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.
| Field | Type | Description |
|---|---|---|
z required | string | path |
x required | string | path |
y required | string | path |
GET /api/v1/pages/{secret}/maps/style
Get page maps style · No authentication
No authentication.
| Field | Type | Description |
|---|---|---|
secret required | string | path |
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.
| Field | Type | Description |
|---|---|---|
defaults required | object | |
defaults.geocoder_url required | string | |
defaults.tiles_url required | string | |
enabled required | boolean | |
geocoder_url required | string | |
locked required | array of string | |
tiles_url required | string |
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.
| Field | Type | Description |
|---|---|---|
enabled | boolean | null | |
geocoder_url | string | null | |
tiles_url | string | null |
| Field | Type | Description |
|---|---|---|
defaults required | object | |
defaults.geocoder_url required | string | |
defaults.tiles_url required | string | |
enabled required | boolean | |
geocoder_url required | string | |
locked required | array of string | |
tiles_url required | string |