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):


2.  Add the query statement:


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.


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


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.