Help users find what they're looking for without requiring them to fully specify their search term.
Endpoint
https://maps.track-asia.com/api/v1/autocomplete
Parameters
| Parameter | Values | Require | Description | Example |
|---|---|---|---|---|
text | String (required) | ✔ | Representing what a user has typed | 2 Nguyen Hue |
key | String (required) | ✔ | API key (use your own key; public_key is limited and for testing only) | public_key |
lang | Target language | The target language code in the BCP47 standard. Only the language subtag information is used to set the target language. | vi | |
focus.point.lat | {latitude} | Latitude to focus search based on geographic area | 10.761 | |
focus.point.lon | {longitude} | Longitude to focus search based a geographical area | 106.68 | |
new_admin | true , false (default) | Return address according to new administrative boundaries | true | |
include_old_admin | Boolean | Return both old and new addresses in parallel (only available when new_admin=true) | true | |
size | Number | The number of results returned | 5 |
Example Code
Example 1: Return new administrative boundaries
https://maps.track-asia.com/api/v1/autocomplete?new_admin=true&lang=vi&text=2 Nguyen Hue&key=public_key
Example 2: Return both old and new addresses
https://maps.track-asia.com/api/v1/autocomplete?new_admin=true&include_old_admin=true&lang=vi&text=2 Nguyen Hue&key=public_key
# Example 1: Return new administrative boundaries
curl -G "https://maps.track-asia.com/api/v1/autocomplete" \
--data-urlencode "lang=vi" \
--data-urlencode "text=2 Nguyen Hue" \
--data-urlencode "key=public_key" \
--data-urlencode "new_admin=true"
# Example 2: Return both old and new addresses
curl -G "https://maps.track-asia.com/api/v1/autocomplete" \
--data-urlencode "lang=vi" \
--data-urlencode "text=2 Nguyen Hue" \
--data-urlencode "key=public_key" \
--data-urlencode "new_admin=true" \
--data-urlencode "include_old_admin=true"
// Example 1: Return new administrative boundaries
const response1 = await fetch("https://maps.track-asia.com/api/v1/autocomplete?new_admin=true&lang=vi&text=2 Nguyen Hue&key=public_key")
const data1 = await response1.json()
console.log(data1)
// Example 2: Return both old and new addresses
const response2 = await fetch("https://maps.track-asia.com/api/v1/autocomplete?new_admin=true&include_old_admin=true&lang=vi&text=2 Nguyen Hue&key=public_key")
const data2 = await response2.json()
console.log(data2)
Response
JSON Response
The response is a JSON object with the following structure:
type:"FeatureCollection". Indicates the type of GeoJSON object.-
geocoding: Metadata object of the response:timestamp: Response timestamp (Unix timestamp, milliseconds).
-
features: An array ofFeatureobjects, each representing a suggested location. EachFeaturehas the following structure:type:"Feature". Indicates the type of GeoJSON feature.-
geometry: Represents the geometry of the feature.type:"Point". Indicates the geometry type is a point.coordinates: An array of[longitude, latitude]representing the point's coordinates.
-
properties: An object containing properties of the feature:id: A unique identifier for the feature.gid: A global identifier for the feature.layer: The layer type of the feature (e.g.,"venue","street").country_code: The two-letter country code.name: The name of the location.housenumber: The house number (if available).street: The street address of the location (if available).confidence: A score indicating the confidence level of the result.country: The name of the country.country_a: The three-letter country code.region: The name of the region.region_a: The region code.county: The name of the county.locality: The name of the locality.label: A formatted label for the location.country_id: The ID of the country.region_id: The ID of the region.county_id: The ID of the county.locality_id: The ID of the locality.
The following fields only appear when
new_admin=trueandinclude_old_admin=true:old_region: Region name according to the old administrative boundaries (before merging/adjustment).old_region_a: Abbreviation code of the old region.old_region_id: ID of the old region.old_county: County name according to old boundaries (if applicable).old_county_id: ID of the old county (if applicable).old_locality: Locality name according to old boundaries.old_locality_id: ID of the old locality.old_label: Full formatted address label according to old administrative boundaries (typically includes the old county name).
-
bbox: An array representing the bounding box of the results in the format[minLon, minLat, maxLon, maxLat].
Next steps
- Try API playground