Skip to content

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 Description Example
text String (required) Representing what a user has typed 2 Nguyen Hue
lang Target language The target language code in the BCP47 standard. Only the language subtag information is used to set the target language. vi
size Number The number of results returned 5
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
key String (required) API key public_key

Example Code

curl -G "https://maps.track-asia.com/api/v1/autocomplete" \
--data-urlencode "lang=vi" \
--data-urlencode "text=2 Nguyen Hue" \
--data-urlencode "focus.point.lat=10.761" \
--data-urlencode "focus.point.lon=106.68" \
--data-urlencode "size=5" \
--data-urlencode "key=public_key"
const response = await fetch("https://maps.track-asia.com/api/v1/autocomplete?lang=vi&text=2 Nguyen Hue&focus.point.lat=10.761&focus.point.lon=106.68&size=2&key=public_key")
const data = await response.json()
console.log(data)

Response

JSON Response

The response is a JSON object with the following structure:

  • type: "FeatureCollection". Indicates the type of GeoJSON object.
  • features: An array of Feature objects, each representing a suggested location. Each Feature has 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.
      • 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.
  • bbox: An array representing the bounding box of the results in the format [minLon, minLat, maxLon, maxLat].

Next steps