Specifying Lat/Lng Locations

The Mapquest Platform Services all use locations. The following documentation is to explain different ways locations can be formed across all the services offered.

Contents

Lat/Lng Locations

When using key/value pairs as input, lat/lng locations are all that can be given. The following lat/lng location formats are supported:

Format Example
latLng 54.0484068,-2.7990345
JSON Object
(See below for details)
{latLng:{lat:54.0484068,lng:-2.7990345}}

Advanced Locations

Using JSON or XML as your input format allows a higher degree of lat/lng specification.

To specify locations in JSON or XML, you must include a "locations" parameter that encloses a list of locations. It is locations:[ and ] in JSON, or <locations> and </locations> in XML. The contents of the locations must be Location objects.

Location objects are either

  • Strings, which are assumed to be lat/lngs (as described above), or
  • Location objects, which are JSON objects containing the parameters described in the table below.

Request Parameters

Field Name Description
latLng Returns the latitude, longitude for routing and is the nearest point on a road for the entrance.

Request Sample

Below is an example of forming a Locations object which would be used for getting Directions.

JSON Request Example XML Request Example
{
   locations:
   [
      {
         latLng:
         {
            lat: 54.0484068,
            lng: -2.7990345
         }
         latLng:
         {
            lat: 53.9593817,
            lng: -1.0814175
         }
      }
   ]
}
<locations>
   <location>
      <latLng>
         <lat>54.0484068</lat>
         <lng>-2.7990345</lng>
      </latLng>
      <latLng>
         <lat>53.9593817</lat>
         <lng>-1.0814175</lng>
      </latLng>
   </location>
</locations>


  © MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use