Embeds – GET /v1/embed
GET /v1/embed
Section titled “GET /v1/embed”Returns an iframe snippet for an interactive map, as { "html": "...", "src": "..." }. It
needs no key and isn’t counted. You can build the same snippet in your browser with
the embed generator.
Params: lat, lon, zoom, types, theme (light|dark), lang, w,
h, and dots. The embedded map shows amenity dots and walking times; dots=0 hides the
dots. The API ignores mode and budget.
curl "https://aportee.ca/v1/embed?lat=43.25&lon=-79.82&zoom=11&types=grocery"Your own markers
Section titled “Your own markers”Add markers to draw up to 20 of your own points on the embedded map, as lat,lon pairs
separated by semicolons. They take the map’s pin colours and sit over everything else:
curl "https://aportee.ca/v1/embed?lat=53.5465&lon=-113.555&zoom=15&markers=53.5465,-113.555;53.5485,-113.548"Your page can also send markers to the embed it hosts as a message: up to 500 points, with
labels or the ring style. When the embed’s map is listening, it posts this message to your
page: { "type": "aportee:markers-ready" }. Send the embed
{ "type": "aportee:markers", "markers": … }, with markers the same GeoJSON
FeatureCollection as POST /v1/image takes, or
"markers": null to clear them. If your page attaches its listener after the iframe loads, it
misses the ready message; in that case, send the markers on the iframe’s load event.
The embed answers each message with
{ "type": "aportee:markers-result", "ok": true, "count": 2 }. For a collection it refuses,
it answers "ok": false with a detail naming the marker, and keeps the markers it had. Your
page can be on any domain.
<iframe id="aportee-map" width="600" height="450" style="border:0" title="à portée map" src="https://aportee.ca/?embed=1&ll=53.5465,-113.555,15&a=grocery"></iframe><script> const map = document.getElementById('aportee-map'); const permits = { type: 'FeatureCollection', features: [ { type: 'Feature', geometry: { type: 'Point', coordinates: [-113.555, 53.5465] }, properties: { label: 'Permit 1' } }, { type: 'Feature', geometry: { type: 'Point', coordinates: [-113.548, 53.5485] }, properties: { label: 'Permit 2', style: 'ring' } }, ] }; window.addEventListener('message', (event) => { if (event.source !== map.contentWindow) return; if (event.data?.type === 'aportee:markers-ready') { map.contentWindow.postMessage({ type: 'aportee:markers', markers: permits }, 'https://aportee.ca'); } else if (event.data?.type === 'aportee:markers-result') { console.log(event.data); } });</script>Your own areas
Section titled “Your own areas”Your page can also draw areas on the embed it hosts, such as a town boundary or a district, the
same way: once the embed posts { "type": "aportee:markers-ready" }, send it
{ "type": "aportee:areas", "areas": … }, with areas a GeoJSON FeatureCollection of up to 50
Polygon, MultiPolygon, LineString or MultiLineString features, 50,000 positions in all, or
"areas": null to clear them. Each feature can have a style: area (the default) draws a
light fill with an edge, and outline draws a dashed line. The areas sit under the place dots
and your markers, in the map’s pin colour for its theme.
The embed answers each message with { "type": "aportee:areas-result", "ok": true, "count": 1 },
or "ok": false with a detail naming the feature it refused, keeping the areas it had.
map.contentWindow.postMessage({ type: 'aportee:areas', areas: { type: 'FeatureCollection', features: [ { type: 'Feature', properties: { style: 'outline' }, geometry: { type: 'LineString', coordinates: [[-113.56, 53.54], [-113.54, 53.54], [-113.54, 53.55]] } },] } }, 'https://aportee.ca');