Reverse Geocode
Problem: I have a coordinate. I need the nearest address.Prerequisites
- A HERE API key with Geocoding & Search entitlement
export HERE_API_KEY="..."
Reverse geocoding is at
revgeocode.search.hereapi.com — a different host from forward geocoding.The code
Response walkthrough
distance — metres from your query coordinate to the returned address.
types=area filters to administrative areas — city, district, region — when you do not need a street address.
Common mistakes
Reverse-geocoding on packet ingest. The dominant cost error in telematics. Looping/revgeocode over a list. /multi-revgeocode exists.
No coordinate rounding before cache lookup. Sub-metre jitter, zero hits.
Ignoring heading. On a divided highway, a coordinate 15 metres from the centreline resolves to either carriageway. Provide the drive direction where telematics supplies it — it is free accuracy and it removes “the truck is on the wrong side of the interstate” tickets.
Using this to snap a GPS trace to roads. That is Route Matching, and only Route Matching survives an audit.
Using this for geofence containment. That is ST_Contains against a polygon in your own database. See Geofencing.
Storing the nearest address as the vehicle’s true location.
Real-time endpoints for historical enrichment. Batch it.
No spatial filter. A coordinate in the ocean returns something eventually.
Production considerations
Trigger on stop detection, not on packet arrival. One address per stop, not 24. Instrument the ratio. Reverse-geocode calls ÷ detected stops. Near 1 is correct. Cache by rounded coordinate. ~5 decimal places. Resolve depots and customer sites once, permanently. Known, fixed, finite. Batch the historical backfill. Six months of trip history is a job, not a stream. Geocode lazily on view. A dispatcher watching one vehicle needs one address. Do not pre-resolve the other 199.Related
Reverse Geocoding
Drive-direction snapping, spatial filters, and result types.
Vehicle Tracking
Ingesting GPS without touching an API per packet.
Route Matching
What this is not.
Geofencing
Containment is a spatial query, not a geocode.
HERE documentation
Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. Talk to us.