Skip to main content

Reverse Geocode

Problem: I have a coordinate. I need the nearest address.
Do not reverse-geocode raw GPS pings on ingest.A vehicle emitting a position every ten seconds over a nine-hour shift produces 3,240 packets. Across 200 vehicles: 648,000 per day. The address is needed when a human looks at a screen or when a stop is detected. Not at 3:47:20am on I-80.

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.
A returned address is a nearest match, not a truth. The coordinate sits somewhere; HERE returns the closest addressable feature.distance: 280 means the nearest address is 280 metres away — in rural areas, potentially on a different property. Store the original coordinate alongside the resolved 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.

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.