Skip to content

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

https://maps.track-asia.com/api/v2/geocode/json?latlng=10.7952219,106.7217912&key=public_key
https://maps.track-asia.com/api/v2/geocode/xml?latlng=10.7952219,106.7217912&key=public_key
curl -G "https://maps.track-asia.com/api/v2/geocode/xml?latlng=10.7952219,106.7217912&key=public_key"
const response = await fetch("https://maps.track-asia.com/api/v2/geocode/json?latlng=10.7952219,106.7217912&key=public_key")
const data = await response.json()
console.log(data)

Response

JSON Response

The response is a JSON object with the following structure:

  • plus_code: Object with global_code (and possibly compound_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 with long_name, short_name, and types for each address part.
    • geometry: Object with location (lat/lng), location_type, and viewport (northeast/southwest bounds).
    • plus_code: Object with compound_code and global_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.

Error

When the geocoder returns a status code other than OK, there may be an additional error_message field within the Geocoding response object. This field contains more detailed information about the reasons behind the given status code.

Next steps