17  REST for Geocoding

A geocoding query is a utility query that takes an address, or part of an address, and returns estimated latitude and longitude coordinates of the specified location. Latitude and longitude are returned for the following types of geocoding query requests:

The following steps illustrate how to specify a geocoding operation, in this case for a complete street address:

1.  Start with the host, version, and API key (substitute your own key):

http://query.mapfluence.com/2.0/MFDOCS

2.  Add the query statement:

/spatialquery.json

3.  Add the query definition in the form of a query string, in this case specifying the following properties (with "+" substituted for spaces):
- street=690+Fifth+St.: the street address.
- city=San+Francisco: the city.
- state=CA: the state code.
- postalcode=94107: the postal code.

?street=690+Fifth+St.&city=San+Francisco&state=CA&postalcode=94107

4.  Put all the pieces together and you have the complete REST path for the query:

http://query.mapfluence.com/2.0/MFDOCS/geocoder.json?street=690+Fifth+St.&city=San+Francisco&state=CA&postalcode=94107

This query returns the following JSON structure with the lattitude and longitude (to see the complete response body, open a browser window and enter the URL into the address field):

[
  {
    "lat": 37.7753486633,
    "lon": -122.397674561
  }
]

Note: For complete details on the purpose and valid values of spatial query properties, both required and optional, refer to the /geocoder.json page of the Mapfluence REST API Reference at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/query/GeocodeQuery.

Top