OnDemand Users - Please read this important announcement!
Query Parser API
The Query Parser offers output in 3 formats:
- JSON -- The most fully featured format, the JSON format includes all the available information about the locations.
- KML -- A more lightweight format, but suitable for use in applications which use KML.
- PNG -- An image output format, which will return an image with the locations returned displayed on the image.
The purpose of the Query Parser API is to take a short string, such as the one which might be entered in a search box, and seperate it into a query string and a geographic location. This information is then returned, with information about the location, the confidence that the location is correct geographically, and the remaining text from the query, suitable for submission to the Search API.
To form a request URL:
- Start with http://ondemand.metacarta.com/webservices/QueryParser/
- Append the format, one of JSON, KML, or PNG: http://ondemand.metacarta.com/webservices/QueryParser/JSON
- Choose an authentication method: one of session or basic: http://ondemand.metacarta.com/webservices/QueryParser/JSON/basic
- Append the appropriate parameters to the request, as described below.
Examples of Usage
Request Parameters
- version:
-
Required
default value: input other than the allowed value raises an error message
allowed values: 1.0.0
usage: The requestor must specify the API version they wish to use. The API requires a valid version parameter. - query:
-
Required
default value: ''
allowed values: string
usage: The query string is the input for which a QueryParser search is initiated. - bbox:
-
Optional
default value: -180,-90,180,90
allowed values: a comma separated string of minlon,minlat,maxlon,maxlat
usage: Defines the query's geographic extent. If no locations are found in the bounding box, but one is found outside the bounding box, a warning will be issued, but the query will succeed. - width:
-
Optional
default value: 512
allowed values: positive integer
usage: Determines the width of the image returned by the PNG QueryParser output. - height:
-
Optional
default value: 383
allowed values: positive integer
usage: Determines the height of the image returned by the PNG QueryParser output.
