Follow

How to search for a public POI by name

Here's an example searching for Avis 

http://www.mapquestapi.com/search/v2/radius?key=<YOUR_KEY_HERE>&origin=1015%20museum%20circle%20jacksonville%20FL&radius=30&hostedData=mqap.ntpois%7Cname%20ilike%20?%7Cavis%25&maxMatches=25&ambiguities=ignore

breaking it down
http://www.mapquestapi.com/search/v2
The base URL

/radius?
The search type - this example is radius - there are others like polygon & corridor

key=<YOUR_KEY_HERE>
Replace this with your key here

&origin=1015%20museum%20circle%20jacksonville%20FL
your origin for a radius search can be:
- an address
- an IP address (eg: origin=192.168.0.0.1)
- a Lat,Lng coordinate (eg: origin=40,123,-74.123)

&radius=30
radius in miles

&hostedData=mqap.ntpois%7Cname%20ilike%20?%7Cavis%25
The dataset to search, plus your "filter" search fragment - this is what makes it work how you want:
decoded string, broken down:
&hostedData=mqap.ntpois - this is the table name to search.
Schema is here: http://www.mapquestapi.com/search/ds-ntpois.html#mqap.ntpois
|name ilike ?|avis% - notice the pipe separators. This is the FIELD to filter on, the sql character to use, then a question mark. the question mark is filled in with the value on the other side of the next pipe.
so - &hostedData=mqap.ntpois|name ilike ?|avis%
translates to "select from mqap.ntpois where name ilike 'avis%'

&maxMatches=25
maximum results to return

&ambiguities=ignore
this is only needed if using an address as an origin - this tells it to ignore any ambiguous geocode results and just use the first geocode result as the origin (otherwise, if there are ambiguities, the search will stop)

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk