Municipalities
Municipal tools work with parcels and addresses and need to be understood by residents. mapx is free with an API token (Access and limits); snippets that use mapx.… expect mapx.setAccessToken("YOUR_TOKEN") once, or accessToken in mapx.map. The pieces below combine the cadastre, the address register, the timetable and the map for the web page of a municipality.
Parcels
The cadastre is available as a vector tileset for drawing and as an API for the parcel at a point.
const map = mapx.map({ accessToken: "YOUR_TOKEN", container: "map", style: "satellite-streets", center: [15.3294, 48.2272], zoom: 17 });
new mapx.ParcelPopup(map); // click: number, area, cadastral municipality, buildings
Search for a parcel by its number (the cadastral municipality is part of the identity):
curl -s -H "Authorization: Bearer YOUR_TOKEN" "https://api.mapx.at/v1/geocode?q=KG%2014143%20Gst%20473/1&types=parcel&limit=1" | jq '.features[0] | {place_name, center, id: .properties.parcel_id}'The boundaries come from the BEV cadastral map (DKM). The area is computed from the boundary lines and deviates from the register by per mille. State this where the data is shown: for orientation, not legally binding.
Check addresses
Forms for registrations, applications and reports should accept only existing addresses. address/validate compares the input with the address register and returns match, corrected, ambiguous or not_found with the corrected address and coordinates.
const q = new URLSearchParams({ street: "Haubtplatz", housenumber: "1", postcode: "3390", place: "Melk" });
const r = await (await fetch(`https://api.mapx.at/v1/address/validate?${q}&access_token=YOUR_TOKEN`)).json();
console.log(r.status, r.deviations.map((d) => `${d.field}: ${d.input} > ${d.expected}`), r.address?.full_address ?? r.candidates?.map((c) => c.full_address));While the person types, offer address autofill; for lists with many addresses use POST /v1/geocode/batch (Search).
Departures at the town hall
Residents ask “When does the next bus go?”. The timetable (scheduled, no real-time data) is one request away:
const [stop] = await mapx.stops({ near: [15.3294, 48.2272], radius: 400, limit: 1 });
const board = await mapx.departures(stop.id, { limit: 6 });
document.querySelector("#abfahrten").innerHTML = board.map((d) => `<li>${d.time.slice(11, 16)} ${d.line.name} → ${d.headsign}</li>`).join("");Or add new mapx.DeparturesPopup(map) to a map. See Transit departures and the example. Timetable data: ÖBB-Personenverkehr AG, data source Mobilitätsverbünde Österreich (CC BY 4.0).
Embed a map in the municipal website
A map needs one HTML file, MapLibre and the style URL, a free public token and no build (Embed a map). Host the page with your content management system, or embed the file as <iframe>:
<iframe src="/karte.html" title="Map of our municipality" style="width:100%;height:480px;border:0" loading="lazy"></iframe>For a plain picture without JavaScript (print, newsletter, page without scripts) use a static image:
<img alt="Location of the town hall" width="600" height="400"
src="https://api.mapx.at/v1/static/streets/pin-l%2Be11d48(15.3294,48.2272)/15.3294,48.2272,16/600x400.png?access_token=YOUR_TOKEN">Show your own data (playgrounds, collection points, closures) as GeoJSON on the map. The <img> URL carries the token: use a public token (mx_pk_…) with your website as allowed origin. Keep the attribution of the data visible (Attribution).
Next steps
- Parcels and Search
- Transit departures
- Style the basemap in the colours of your municipality