Find places or addresses near a longitude/latitude pair
Endpoint
https://maps.track-asia.com/api/v2/geocode/{outputFormat}
outputFormat
outputFormat | Description |
---|---|
json (recommended) | indicates output in JavaScript Object Notation (JSON) |
xml | indicates output in XML |
Parameters
Parameter | Values | Description | Example |
---|---|---|---|
latlng | {latitude},{longitude} (required) | The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. | 10.7952219,106.7217912 |
key | String (required) | API key | public_key |
radius | Number | The search radius in meters (m) | 500, 100, 50, etc. |
Example code
Response
JSON Response
The response is a JSON object with the following structure:
plus_code
: Object withglobal_code
(and possiblycompound_code
).status
: Status string (e.g., "OK").results
: An array of result objects. Each result contains:place_id
: Unique identifier for the place.name
: Name of the place.sublabel
: Additional address or context for the place.formatted_address
: Full formatted address.address_components
: Array of objects withlong_name
,short_name
, andtypes
for each address part.geometry
: Object withlocation
(lat/lng),location_type
, andviewport
(northeast/southwest bounds).plus_code
: Object withcompound_code
andglobal_code
(may be repeated inside results).partial_match
: Boolean indicating if the result is a partial match.icon
,icon_background_color
,class
,subclass
: Visual and classification info.types
: Array of place types.
XML Response
The XML response has a similar structure, with elements corresponding to the JSON fields above. Notable differences:
- XML results are wrapped in a root
<GeocodeResponse>
element. - Arrays in JSON (like
results
,address_components
,types
) become repeated elements in XML (like<result>
,<address_component>
,<type>
). - Blank elements are indicated by empty arrays in JSON, but by the absence of such elements in XML.
Status
Status | Description |
---|---|
OK | indicates that no errors occurred; the address was successfully parsed and at least one geocode was returned. |
ZERO_RESULTS | indicates that the geocode was successful but returned no results. This may occur if the geocoder was passed a non-existent address. |
Next steps
- Try API playground