Specifying Locations
Single Line Locations
When using key/value pairs as input, single-line locations are all that can be given. The following single-line address formats are supported:
Format | Example |
---|---|
city (AA5), state (AA3) | Denver, CO |
city, state, postalCode | Denver, CO, 80202 |
postalCode | 80202 |
street, city, state | 1555 Blake St, Denver, CO |
street, city, state, postalCode | 1555 Blake St, Denver, CO 80202 |
street, postalCode | 1555 Blake St, 80202 |
latLng | 39.750307,-104.999472 |
JSON Object (See 'Advanced Locations' below for details) | {"street": "1555 Blake St"} |
Single-Line Response
{
"locations": [
{
"street": "1555 Blake St",
"adminArea6": "",
"adminArea6Type": "Neighborhood",
"adminArea5": "Denver",
"adminArea5Type": "City",
"adminArea4": "Denver",
"adminArea4Type": "County",
"adminArea3": "CO",
"adminArea3Type": "State",
"adminArea1": "US",
"adminArea1Type": "Country",
"postalCode": "80202-1625",
"geocodeQualityCode": "P1AAA",
"geocodeQuality": "POINT",
"dragPoint": false,
"sideOfStreet": "N",
"linkId": "fcc83bcc-4794-4b89-ab79-8058919d70b5",
"unknownInput": "",
"type": "s",
"latLng": {
"lat": 39.750307,
"lng": -104.999472
},
"displayLatLng": {
"lat": 39.750307,
"lng": -104.999472
}
}
]
}
<locations>
<location>
<street>1555 Blake St</street>
<adminArea6 type="Neighborhood"/>
<adminArea5 type="City">Denver</adminArea5>
<adminArea3 type="State">CO</adminArea3>
<adminArea4 type="County">Denver</adminArea4>
<postalCode>80202-1625</postalCode>
<adminArea1 type="Country">US</adminArea1>
<geocodeQuality>POINT</geocodeQuality>
<geocodeQualityCode>P1AAA</geocodeQualityCode>
<dragPoint>false</dragPoint>
<sideOfStreet>N</sideOfStreet>
<displayLatLng>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</displayLatLng>
<linkId>fcc83bcc-4794-4b89-ab79-8058919d70b5</linkId>
<unknownInput/>
<type>s</type>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</location>
</locations>
Advanced Locations
The 5-Box Input address format (which is compatible with JSON and XML), allows for a higher degree of address specification by entering the full address in its individual location parameters. The 5-Box Input format is beneficial as it bypasses the parsing functionality of the single-line request.
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 single-line addresses (as described above), or
- Location objects, which are JSON objects containing the parameters described in the table below.
Request and Response Parameters
Field | Description | Required |
---|---|---|
key String | The API Key. | Yes |
latLng String | Returns the latitude, longitude for routing and is the nearest point on a road for the entrance. | Yes |
street String | Street address - (If this is the only parameter given in a Location object, a single-line address location will be made from this parameter) | Yes |
adminArea5 or city String | City name | Yes |
adminArea4 or county String | County name | Yes |
adminArea3 or state String | State name | Yes |
adminArea1 or county String | Country name | Yes |
postalCode String | Postal code | Yes |
type String | Type of location.
| Yes |
dragPoint Boolean | Is location a drag point? This option only applies when making a dragroute call. - true - location is a drag point - false - location is not a drag point (default) | No |
5-Box Input Response
{
"locations": [
{
"street": "1555 Blake St",
"adminArea6": "",
"adminArea6Type": "Neighborhood",
"adminArea5": "Denver",
"adminArea5Type": "City",
"adminArea4": "Denver",
"adminArea4Type": "County",
"adminArea3": "CO",
"adminArea3Type": "State",
"adminArea1": "US",
"adminArea1Type": "Country",
"postalCode": "80202-1625",
"geocodeQualityCode": "P1AAA",
"geocodeQuality": "POINT",
"dragPoint": false,
"sideOfStreet": "N",
"linkId": "fcc83bcc-4794-4b89-ab79-8058919d70b5",
"unknownInput": "",
"type": "s",
"latLng": {
"lat": 39.750307,
"lng": -104.999472
},
"displayLatLng": {
"lat": 39.750307,
"lng": -104.999472
}
}
]
}
<locations>
<location>
<street>1555 Blake St</street>
<adminArea6 type="Neighborhood"/>
<adminArea5 type="City">Denver</adminArea5>
<adminArea3 type="State">CO</adminArea3>
<adminArea4 type="County">Denver</adminArea4>
<postalCode>80202-1625</postalCode>
<adminArea1 type="Country">US</adminArea1>
<geocodeQuality>POINT</geocodeQuality>
<geocodeQualityCode>P1AAA</geocodeQualityCode>
<dragPoint>false</dragPoint>
<sideOfStreet>N</sideOfStreet>
<displayLatLng>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</displayLatLng>
<linkId>fcc83bcc-4794-4b89-ab79-8058919d70b5</linkId>
<unknownInput/>
<type>s</type>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</location>
</locations>
Request Samples
Below is an example of forming a Locations
object. This would be used for getting Directions, doing Batch Geocoding, or creating search areas from multiple locations in the Search Service.
{
"locations": [
{
"street": "1555 Blake St",
"city": "Denver",
"county": "Denver",
"state": "CO"
},
{
"latLng": {
"lat": 39.750307,
"lng": -104.999472
}
}
]
}
<locations>
<location>
<street>1555 Blake St</street>
<city>Denver</city>
<county>Denver</county>
<state>CO</state>
</location>
<location>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</location>
</locations>
Below is an example of forming a Location
object. All of the services not mentioned above use only one location at a time. Below is how to use just one location.
{
"location": {
"street": "1555 Blake St",
"city": "Denver",
"county": "Denver",
"state": "CO"
}
}
<location>
<street>1555 Blake St</street>
<city>Denver</city>
<county>Denver</county>
<state>CO</state>
</location>
Response Parameters
In addition to the parameters listed above, there are several attributes of a Location
object which are return-only. You might see these attributes in the response from a service call, but they are not settable attributes and are therefore ignored if supplied as input.
Field Name | Description |
---|---|
displayLatLng | A lat/lng pair which can be helpful when showing this address as a Point of Interest. |
geocodeQuality | The precision of the geocoded location. L1=Address, Z1=postalCode, etc. |
linkId | Identifies the closest road to the address for routing purposes. |
sideOfStreet | Specifies the side of street. - L - left - R - right - N - none (default) |
Response Sample
{
"locations": [
{
"street": "1555 Blake St",
"adminArea6": "",
"adminArea6Type": "Neighborhood",
"adminArea5": "Denver",
"adminArea5Type": "City",
"adminArea4": "Denver",
"adminArea4Type": "County",
"adminArea3": "CO",
"adminArea3Type": "State",
"adminArea1": "US",
"adminArea1Type": "Country",
"postalCode": "80202-1625",
"geocodeQualityCode": "P1AAA",
"geocodeQuality": "POINT",
"dragPoint": false,
"sideOfStreet": "N",
"linkId": "fcc83bcc-4794-4b89-ab79-8058919d70b5",
"unknownInput": "",
"type": "s",
"latLng": {
"lat": 39.750307,
"lng": -104.999472
},
"displayLatLng": {
"lat": 39.750307,
"lng": -104.999472
}
}
]
}
<locations>
<location>
<street>1555 Blake St</street>
<adminArea6 type="Neighborhood"/>
<adminArea5 type="City">Denver</adminArea5>
<adminArea3 type="State">CO</adminArea3>
<adminArea4 type="County">Denver</adminArea4>
<postalCode>80202-1625</postalCode>
<adminArea1 type="Country">US</adminArea1>
<geocodeQuality>POINT</geocodeQuality>
<geocodeQualityCode>P1AAA</geocodeQualityCode>
<dragPoint>false</dragPoint>
<sideOfStreet>N</sideOfStreet>
<displayLatLng>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</displayLatLng>
<linkId>fcc83bcc-4794-4b89-ab79-8058919d70b5</linkId>
<unknownInput/>
<type>s</type>
<latLng>
<lat>39.750307</lat>
<lng>-104.999472</lng>
</latLng>
</location>
</locations>