Search (V2)
Searches for keywords and returns a list of relevant places.
Url
Method: GET
https://maps.track-asia.com/api/v2/geocode/{outputFormat}
Example
https://maps.track-asia.com/api/v2/geocode/json?address=Landmark 81&key=public_key
https://maps.track-asia.com/api/v2/geocode/xml?address=Landmark 81&size=1&key=public_key
outputFormat
outputFormat | Description |
---|---|
json | indicates output in JavaScript Object Notation (JSON) |
xml | indicates output in XML |
Parameters
Parameter | Values | Description | Example |
---|---|---|---|
address | String (required) | address — The street address that you want to geocode. Specify addresses in accordance with the format used by the national postal service of the country concerned. Additional address elements such as business names and unit, suite or floor numbers should be avoided. Street address elements should be delimited by spaces (shown here as url-escaped to %20) | Landmark 81 |
key | String (required) | API key | public_key |
size | Number | The maximum number of results to return from the search. | 1 |
Response
Geocoding responses are returned in the format indicated by the output flag within the URL request, or in JSON format by default.
In this example, the Geocoding API requests a json response for a query on the address "Landmark 81".
This request demonstrates using the JSON output flag:
https://maps.track-asia.com/api/v2/geocode/json?address=Landmark 81&key=public_key
This request demonstrates using the XML output flag:
https://maps.track-asia.com/api/v2/geocode/xml?address=Landmark 81&size=1&key=public_key
JSON Response
{"predictions": [{"description": "Toà nhà BW, 2:3, Phường 22, Quận Bình Thạnh, Thành phố Hồ Chí Minh, Việt Nam","matched_substrings": [{"length": 8,"offset": 0}],"place_id": "Ei9UaCBuYXRoIEJXLCBMMjMzIFBodWgsIEF1Z2VudCBMYW5nIE1pdGgsIEF1Z2VudCBMYW5nIE1pdGgsIFRoYXRoaCBwaCBLYW5naCBMYW5nLCBUaGFuaCBwaCBLYW5naCBMYW5nLCBXi4gNam","reference": "Ei9UaCBuYXRoIEJXLCBMMjMzIFBodWgsIEF1Z2VudCBMYW5nIE1pdGgsIEF1Z2VudCBMYW5nIE1pdGgsIFRoYXRoaCBwaCBLYW5naCBMYW5nLCBUaGFuaCBwaCBLYW5naCBMYW5nLCBXi4gNam","structured_formatting": {"main_text": "Toà nhà BW","main_text_matched_substrings": [{"length": 8,"offset": 0}],"secondary_text": "Phường 22, Quận Bình Thạnh, Thành phố Hồ Chí Minh, Việt Nam"},"terms": [{"offset": 0,"value": "Toà nhà BW"},{"offset": 11,"value": "Phường 22"},{"offset": 20,"value": "Quận Bình Thạnh"},{"offset": 35,"value": "Thành phố Hồ Chí Minh"},{"offset": 54,"value": "Việt Nam"}],"types": ["establishment","point_of_interest"]}],"status": "OK"}
XML Response
<?xml version="1.0" encoding="UTF-8"?><GeocodeResponse><status>OK</status><result><place_id>6:venue:ef8d3323-f31a-5e13-8e4e-ebbcbfa27072</place_id><name>Landmark72</name><sublabel>E6 Đường Phạm Hùng, Phường Mễ Trì, Quận Nam Từ Liêm, Thành phố Hà Nội</sublabel><formatted_address>Landmark72, E6 Đường Phạm Hùng, Phường Mễ Trì, Quận Nam Từ Liêm, Thành phố Hà Nội</formatted_address><geometry><location><lat>21.017454</lat><lng>105.783494</lng></location><location_type>ROOFTOP</location_type><viewport><northeast><lat>21.019250622349983</lat><lng>105.78541866818874</lng></northeast><southwest><lat>21.01565737765002</lat><lng>105.78156933181127</lng></southwest></viewport></geometry><plus_code><compound_code>2Q8M+X9 Quận Nam Từ Liêm, Thành phố Hà Nội, Việt Nam</compound_code><global_code>7PH72Q8M+X9</global_code></plus_code><partial_match>false</partial_match><icon>building-11</icon><icon_background_color>#5c6f84</icon_background_color><class>building</class><types>point_of_interest</types><types>building</types><address_component><long_name>E6</long_name><short_name>E6</short_name><type>street_number</type></address_component><address_component><long_name>Đường Phạm Hùng</long_name><short_name>Đường Phạm Hùng</short_name><type>route</type></address_component><address_component><long_name>Phường Mễ Trì</long_name><short_name>Phường Mễ Trì</short_name><type>administrative_area_level_3</type><type>political</type></address_component><address_component><long_name>Quận Nam Từ Liêm</long_name><short_name>Quận Nam Từ Liêm</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Thành phố Hà Nội</long_name><short_name>HN</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>Việt Nam</long_name><short_name>VN</short_name><type>country</type><type>political</type></address_component></result></GeocodeResponse>
Status codes
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 messages
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.