Batch Geocoding
Problem: I have four million addresses. Nothing is waiting for the result.Prerequisites
- A HERE API key with Batch entitlement
export HERE_API_KEY="..."
Batch API v7 is at
batch.search.hereapi.com/v7/batch/jobs. It is driven by a serviceHrn parameter that selects which service processes the job.If you are reading a tutorial using batch.geocoder.ls.hereapi.com/6.2/jobs with action=run and outcols=, that is the legacy Batch Geocoder API 6.2. Different host, different parameters, different response format (XML). Prefer v7 for new work.The code
Response walkthrough
Submission:status progresses submitted → queued → running → success | failed | cancelled.
billingTags let you attribute cost per tenant or per customer. Set them if you run a multi-tenant platform. You cannot price a feature whose cost you cannot attribute.
The three status codes that are not errors
Idempotency
The pipeline must survive a worker restart without resubmitting. chunk created → Pending POST /jobs → Submitted ← persist job_id HERE, before polling │ ├─ crash → resume: job_id exists, DO NOT resubmit ▼ GET /jobs/ → Running (poll with backoff) ▼ Succeeded → fetch errors → fetch results → DELETE Persist the chunk-to-job mapping. On resume, retrieve results for jobs already submitted; submit only chunks with no job. Make chunking deterministic. Stable ordering plus fixed size means a restarted process reconstructs the same chunks. A random shuffle does not.Common mistakes
Not deduplicating. Paying for repetition. Not normalizing before deduplicating. Catches only exact string matches. Treating this as a bulk endpoint. It is a job lifecycle. Losing the job ID on restart. Full rebill. Retrying204. Zero errors.
Aggressively retrying 404. The job has not finished.
Hammering after 429. Concurrency limit. Queue.
Assuming all-or-nothing. Read /errors. Handle partial success.
Never deleting jobs. They accumulate.
Loading four million results into memory. Stream.
Not writing results into a durable cache. You will do this again next quarter, and pay again.
Onboarding jobs starving nightly enrichment. Batch concurrency is per-contract.
Production considerations
Order of operations, before any API call:- Normalize (trim, case-fold, expand abbreviations)
- Deduplicate
WHERE geocoded_at IS NULL- Count what remains — and report that number before you report a timeline
Related
Batch Geocoding
The lifecycle, the limits, and the status codes in detail.
High-Volume Geocoding
Queues, retries, monitoring, and what to alert on.
Caching Geocoding Results
Where the output of this pipeline must land.
Geocode an Address
The real-time path, for the trickle of new addresses.
HERE documentation
Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. Talk to us.