Introduction
There are several non-interactive use cases of geocoding, such as geocoding databases, for which it can be useful to send several addresses or positions at once. For these cases PTV Developer provides an asynchronous batch API. The by-addresses, by-texts and by-positions endpoints provide the same functionality as their corresponding endpoints for single requests.
Workflow
In pseudo code a typical workflow for batch geocoding addresses, texts or positions looks like this:
jobId = createLocationsByPositions(request).id
do
jobStatus = getLocationsByPositionsStatus(jobId).status
sleep()
while jobStatus in [ PENDING, PROCESSING ]
if jobStatus in [ SUCCEEDED ] then
response = getLocationsByPositions(jobId)
// handle result
else
// handle error
end
deleteLocationsByPositions(jobId)
Remarks
- Although the batch endpoints process addresses, texts and positions in parallel, they are not optimized for minimum response time. Geocoding thousands of addresses might take some time.