Batch geocoding GET vs. POST

5 posts / 0 new
Last post
beartown
Batch geocoding GET vs. POST

Hi guys,

 

I'd like to geocode a batch of addresses, preferably via address string. This can be done with http://www.mapquestapi.com/geocoding/v1/batch?key=KEY&location=LOCATION1.... The problem is that there is a URL length limit and my data can get truncated.

 

MapQuest offers a POST method, but it looks completely different for some reason. Instead of passing the addresses as strings, it expects them already structured, as described here: https://developer.mapquest.com/documentation/geocoding-api/address/post/

 

I have two questions:

1. Is it possible to pass an array of strings to the POST batch API to make it work just like the GET version? If I just fill the array with strings, I get an error: no 'json' parameter found. Maybe there's some undocumented object property name where I could do that?

2. If I need to use the structured addresses, is there any reference to the API of how to actually pass it? The documentation just provides an example of the city and the state. I'm not sure how to provide the rest, for example street parameter seems to be ignored.

 

Any help is highly appreciated.


MQBrianCoakley
Here is how I did it in curl:

Here is how I did it in curl:

 

curl -d "json={\"locations\": [{\"street\": \"555 17th St, Denver,CO\"},{\"street\": \"Baseline Ave, Boulder,CO\"},{\"street\": \"Golden,CO\"}],\"options\": {\"maxResults\": -1,\"thumbMaps\": true,\"ignoreLatLngInput\": false}}" "http://www.mapquestapi.com/geocoding/v1/batch?key=KEY"

 


beartown
Thanks!

That's it! The street parameter works just like in GET method, but only if there are no other parameters (city, state etc.). Super weird and probably a bug, but at least now I know how to do it.

 

Thanks!


beartown
One more question. Is the

One more question. Is the order of the response batch 100% reliable? I need to match the results with their inputs. I could do it by comparing the real input, but there are some problems with that.

 

Or, alternatively, can I pass any additional parameters to the query? Like one parameter with comma-separated IDs for my own usage or ID to every address in a response?


MQBrianCoakley
The api should return the
The api should return the results as provided. The api will net return unknown parameters from the request.