Geocode an address
GET /v1/geocode
| Parameter | Default | Description |
|---|---|---|
q | Required | Nonblank address text, at most 256 bytes. URL-encode the value. |
limit | 5 | Maximum number of results, from 1 to 20. |
Example request
curl 'https://geo.mke.dev/v1/geocode?q=1421+n+humboldt+ave&limit=1'
Open this request on this server.
Matching normalizes capitalization, punctuation, directions, street-type aliases, and numeric or spelled ordinal street names. City, state, ZIP code, and unit constraints are respected when supplied. Address points take precedence over parcel and street-range fallbacks.
Small street-name typos or omitted components can receive lower confidence. A different house number or explicitly conflicting direction is not substituted. A conflicting street type may be corrected for an exact street-name match with a house number, after strict matches are exhausted. For example, 1421 N Humboldt Blvd resolves to 1421 N Humboldt Ave in the county data.
Reverse geocode a coordinate
GET /v1/reverse
| Parameter | Default | Description |
|---|---|---|
lat | Required | Finite WGS84 latitude, from -90 to 90. |
lon | Required | Finite WGS84 longitude, from -180 to 180. |
limit | 1 | Maximum number of results, from 1 to 20. |
radius | 100 | Nearby-search radius in meters, from 1 to 1000. |
Example request
curl 'https://geo.mke.dev/v1/reverse?lat=43.05&lon=-87.90&radius=100'
Open this request on this server.
Lookup uses the first available tier:
- Address points inside a containing building.
- Address points associated with a containing parcel, or a representative point inside the parcel.
- Nearby address points within the search radius.
- A projection onto a nearby street centerline, without inventing a house number.
The radius limits nearby fallbacks, not addresses associated with a containing building or parcel. Results within the selected tier are ordered by confidence and distance; a larger limit does not add lower-accuracy tiers. Reverse results include distance_m, the distance in meters from the input coordinate to the returned point.
Route between coordinates
POST /v1/route
Send Content-Type: application/json. The maximum request body is 32 KiB; unknown fields are rejected, including within locations.
| Field | Default | Description |
|---|---|---|
locations | Required | 2–20 locations in route order, each with named lat and lon fields. |
locations[].lat | Required | Finite WGS84 latitude, from -90 to 90. |
locations[].lon | Required | Finite WGS84 longitude, from -180 to 180. |
costing | auto | auto, bicycle, or pedestrian. |
units | kilometers | kilometers or miles. |
Example request
curl 'https://geo.mke.dev/v1/route' \
-H 'Content-Type: application/json' \
-d '{"locations":[{"lat":43.0486,"lon":-87.8986},{"lat":43.0426,"lon":-87.9097}],"costing":"auto","units":"kilometers"}'
Waypoints, travel modes, and geocoded addresses
Locations are visited in the supplied order; this endpoint does not optimize waypoint order. To walk or cycle, set costing to pedestrian or bicycle. To return distances in miles, set units to miles. For example, this bicycle request includes an intermediate stop:
curl 'https://geo.mke.dev/v1/route' \
-H 'Content-Type: application/json' \
-d '{"locations":[{"lat":43.0486,"lon":-87.8986},{"lat":43.0426,"lon":-87.9097},{"lat":43.0389,"lon":-87.9065}],"costing":"bicycle","units":"miles"}'
To route between addresses, first geocode each address and choose a result. Map its geometry.coordinates[1] to lat and geometry.coordinates[0] to lon. Routing accepts coordinates, not address strings or OSM identifiers. Only the fields in the request table are accepted.
Routing response fields
Successful routes return HTTP 200 with Content-Type: application/json and Valhalla-format JSON, not GeoJSON. The response has trip.status of 0, trip.status_message, trip.summary, trip.legs, trip.locations, and trip.units. Each leg includes shape, maneuvers, and summary.
| Field | Type | Meaning |
|---|---|---|
trip.status | Integer | 0 for a successful route. Failures use an HTTP error and the error format below. |
trip.status_message | String | Route status description. |
trip.units | String | kilometers or miles, as requested. |
trip.summary.length | Number | Total route distance in the response units. |
trip.summary.time | Number | Estimated travel duration in seconds, not the API's computation time. |
trip.locations | Array | Waypoints with routing location metadata. |
trip.legs | Array | Route legs in travel order. Multiple stops can produce multiple legs. |
trip.legs[].summary | Object | Per-leg distance and travel duration, using the same units as the trip summary. |
trip.legs[].shape | String | Encoded polyline6 for that leg; decode with precision 6 before drawing it. |
trip.legs[].maneuvers | Array | Turn-by-turn directions, including instructions, distances, and travel durations. |
Example response summary
This is an abridged response for the Milwaukee driving request above, showing selected fields only. The full response also contains leg shapes, maneuvers, location metadata, and additional fields. Values depend on the data snapshot:
{
"trip": {
"status": 0,
"units": "kilometers",
"summary": {
"length": 1.815,
"time": 195.023
}
}
}
Leg shapes are encoded polyline6 (six decimal places), not GeoJSON. Decode trip.legs[].shape accordingly. Summary and maneuver lengths use the chosen units; durations (time) are in seconds. Unlike geocoding's [longitude, latitude] arrays, route inputs use named lat/lon fields.
Validation accepts global WGS84 coordinates, but routing coverage is limited to the greater Milwaukee metro area, approximately [-88.60, 42.80, -87.65, 43.60] in [west, south, east, north] order, not all of Wisconsin. Routes can cross county boundaries, and some roads extend beyond these bounds. Locations outside coverage or without a routable point/path may return 422. Transit, live traffic, elevation, and time-dependent routing options are not supported.
Routing may be unavailable while geocoding remains available; unavailable routing returns 503. Route requests have a 30-second total deadline, including time waiting to be processed; exceeding it returns 504. See routing errors and retries for handling these responses.
Clients using routes must attribute OpenStreetMap contributors under the ODbL.
Geocoding response format
Successful geocoding requests return HTTP 200 with Content-Type: application/geo+json and a GeoJSON FeatureCollection. Coordinates are WGS84 in [longitude, latitude] order.
Example feature collection
The parcel identifier below is illustrative; results depend on the loaded data snapshot.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-87.8985732478243, 43.0486198314883]
},
"properties": {
"label": "1421 N HUMBOLDT AVE, Milwaukee, WI 53202",
"house_number": "1421",
"street": "N HUMBOLDT AVE",
"city": "Milwaukee",
"state": "WI",
"postcode": "53202",
"taxkey": "example-parcel-id",
"osm_type": "node",
"osm_id": 4098312619,
"accuracy": "address_point",
"confidence": 1.0
}
}
]
}
Every feature includes the base address and accuracy properties shown above; osm_type, osm_id, and osm_tags are optional. Missing source text is an empty string; house_number is null for unnumbered street or parcel results. An additional unit property appears when present. Separate units remain separate results; duplicate records for the same address are deduplicated.
| Accuracy | Meaning |
|---|---|
address_point | County address-point coordinates, including points found through building or parcel containment. |
parcel | Representative interior point of a parcel, not a surveyed address point. |
street_interpolated | Estimated location along a street centerline using address ranges. |
street | Representative street location or nearest centerline projection, not a precise address. |
confidence is a ranking heuristic, not a calibrated probability or the county locator's score. Interpolated results do not establish that an address or building exists. Geocoding covers Milwaukee County; it is not a nationwide address, intersection, or point-of-interest search service. Routing covers the greater Milwaukee metro area.
No match
No match is a successful HTTP 200 response with an empty feature list:
{"type":"FeatureCollection","features":[]}
Optional OSM enrichment
Forward and reverse features may include a numeric osm_id, an osm_type of node, way, or relation, and an osm_tags object containing all tags from the matched entity in the local OSM cache. Tag keys and string values are preserved verbatim (including keys such as addr:street, building, or name) and are not merged into county address properties. All three properties are absent when no eligible OSM match exists or the match is ambiguous. The type and ID jointly identify an entity; an ID alone is not unique across types.
Construct an entity URL as https://www.openstreetmap.org/<osm_type>/<osm_id>. For example, 1421 N Humboldt Ave matches node/4098312619 in the cached data, verified in both forward and reverse lookup.
address_pointand numberedparcelresults require an exact normalized house number, including its suffix, and street. The returned point must be within 100 m of the OSM node location or way/relation center. Conflicting city, postcode, or unit values reject a candidate when both the county result and OSM entity supply that value.- A unit-specific county result may match an OSM base-building address with no unit, but an OSM address with a conflicting unit is rejected.
- Unnumbered
streetresults match only named OSM highway ways with an exact normalized name and a returned point within 25 m of the highway geometry. - Exactly one eligible entity is required. Multiple eligible entities are ambiguous; the matcher does not guess by choosing the nearest.
street_interpolatedresults and unnumberedparcelresults receive no OSM match.
Enrichment does not change county coordinates, address data, result ranking, accuracy, or confidence. The extract contains address-tagged entities and named roads, not full OSM data. It is not a general point-of-interest matcher or a containment matcher for unaddressed buildings.
Clients using OSM-enriched data must attribute OpenStreetMap contributors. OSM data is licensed under the Open Database License (ODbL).
Coverage and data freshness
Geocoding and reverse geocoding cover Milwaukee County, using county address points, street centerlines, building footprints, and parcels, with optional OpenStreetMap enrichment. Routing has separate greater Milwaukee metro coverage.
Results reflect a data snapshot, not real-time updates, and may change when that snapshot is refreshed. Missing addresses or OSM identifiers do not establish that an address or entity does not exist. Routing does not include live traffic conditions.
Preparation uses five source datasets: four county GeoJSONL layers and one OSM enrichment cache. The JSONL backend loads them directly; the hybrid SQLite backend serves a prebuilt immutable database, alongside a prepared local routing graph. Startup never reads or downloads a PBF and requires neither osmium nor preparation scripts. The Docker image includes only the SQLite snapshot and portable graph, not the source caches; both statewide and metro PBFs are preparation-only inputs.
The current metro enrichment cache contains 495,144 features (169,165,148 bytes). The graph has 29 tiles; its portable runtime is approximately 125 MiB (131,073,107 bytes). Incomplete boundary relation relation/10481013 was omitted during import and recorded in the manifest. The complete-ways crop supplied no complete administrative polygons, so country/admin overrides are unavailable; no timezone database is installed.
Runtime refresh accepts only address_points, streets, buildings, parcels, and osm. The osm downloader uses Overpass and replaces the locally imported enrichment snapshot. Updating the metro enrichment and graph instead requires explicit slice preparation, import, graph build, and packaging, followed by an API restart. SQLite deployments also require an explicit geocoder snapshot rebuild from the updated sources; never modify a database used by a running server. download --source wisconsin is no longer supported.
Errors and HTTP methods
Geocoding uses GET with query parameters; HEAD is also supported and returns no body. Routing uses POST with a JSON body. Error responses use Content-Type: application/json and an error field.
400 Bad Request: missing, invalid, duplicate, or unknown query parameters; invalid route JSON, locations, costing, units, or unknown fields.404 Not Found: unknown route.405 Method Not Allowed: unsupported HTTP method.413 Payload Too Large: route body exceeds 32 KiB.415 Unsupported Media Type: routing requiresapplication/json.422 Unprocessable Entity: no route could be found, including no routable location or no path.500 Internal Server Error: an internal error prevented geocoding or routing from completing.502 Bad Gateway: the service could not produce a valid routing response.503 Service Unavailable: routing is unavailable, or geocoding/routing is temporarily busy.504 Gateway Timeout: the total 30-second routing deadline is exceeded, including time waiting to be processed.
Routing errors and retries
A busy routing service returns HTTP 503 with:
{"error":"routing is busy; retry later"}
Retry busy responses with bounded exponential backoff and jitter rather than immediate retries. Unavailable routing also returns 503; if it persists, contact the service operator rather than retrying indefinitely. A 422 means no route could be calculated for the supplied locations; check the coordinates and routing coverage. A 504 means the total queue-plus-computation deadline was exceeded; reduce load or simplify the request before retrying.
Geocoding overload returns HTTP 503 with {"error":"geocoder busy; retry with backoff"}. Retry with bounded exponential backoff and jitter.
Geocoding error example
Example: a request with limit=0 returns HTTP 400:
{"error":"limit must be between 1 and 20"}
Health check
GET /health returns HTTP 200 with Content-Type: application/json when the server is ready. This does not guarantee routing availability or that a route can be found for particular locations. The health check can succeed even when routing returns 503:
{"status":"ok"}