ENHANCING SEARCH EFFICIENCY WITH MAPFUSION AUTOCOMPLETE API

Overview of Autocomplete

Autocomplete API is a service that provides real-time suggestions for addresses and locations based on user-entered keywords, enabling precise and efficient search results. As users type, the API returns a list of relevant suggestions, optionally filtered by geographic boundaries. Supported outputs include business names, addresses, and points of interest, tailored to the search’s geographic context.

Mapfusion enables developers to integrate Autocomplete functionality into their platforms or applications. As users input information, the API dynamically suggests potential results based on the provided data. This functionality streamlines the search process, allowing users to quickly and accurately select locations from the generated list of suggestions.

You can integrate the Autocomplete feature into your application or website by implementing a text input field powered by the Location Autocomplete utility.

As users type into the input field, the Autocomplete feature generates location-based suggestions in the form of a dropdown list. Once a user selects a location from the suggestions, detailed information about that location is returned, allowing your application to access and utilize this data seamlessly.

How to Integrate Autocomplete

You can integrate the Autocomplete API into your app/website on both Map Fusion platform or other map platforms.

How to add:

Before using Map Fusion Autocomplete API service, ensure that you have your API Key.

You can refer to the guide for registering an account and generating your key in detail here

URL: /place/autocomplete

Method: GET

Example request: 

https://api.mapfusion.io/v1/place/autocomplete?input=aqua&location=16.48180,96.17140&limit=5&radius=10&api_key={YOUR_API_KEY}

Tham số Mô tả Ví dụ
input Search keyword (required). yangon
location Priority search coordinates 16.48180,96.17140
limit Limit the number of returned results, default is 10 5
radius Limit the search within a radius from the specified location (unit: km). Default is 50. 10
more_compound Boolean. If true, Autocomplete will return fields including district, ward, and province. Default is false true

Example Response

"predictions": [
        {
            "description": "WJCV+5VW yagon, Myanmar",
            "place_id": "2789643",
            "reference": "2789643",
            "structured_formatting": {
                "main_text": "WJCV+5VW yagon",
                "secondary_text": "Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
            "description": "XGPM+X4Q Myothandarhtwe, yagon, Myanmar",
            "place_id": "2730288",
            "reference": "2730288",
            "structured_formatting": {
                "main_text": "XGPM+X4Q Myothandarhtwe",
                "secondary_text": "yagon, Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
           "description": "Grand max, Yagon, mdy hwy, Datkhinathiri, Myanmar",
            "place_id": "2557991",
            "reference": "2557991",
            "structured_formatting": {
                "main_text": "Grand max",
                "secondary_text": "Yagon, mdy hwy, Datkhinathiri, Myanmar)"
            },
            "terms": [],
            "types": []
        },
        {
            "description": "Watashi H, South dagon Yagon, 36664, Myanmar",
            "place_id": "2223895",
            "reference": "2223895",
            "structured_formatting": {
               "main_text": "Watashi H",
                "secondary_text": "South dagon Yagon, 36664, Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
            "description": "V457+W3P Zanyehtet, Yangon, 5th St, Yagon, Myanmar",
            "place_id": "2272401",
            "reference": "2272401",
            "structured_formatting": {
                "main_text": "V457+W3P Zanyehtet",
                "secondary_text": "Yangon, 5th St, Yagon, Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
            "description": "832Q+RXJ Mya Yagon Project, Taik Kyi, Myanmar",
            "place_id": "2382285",
            "reference": "2382285",
            "structured_formatting": {
                "main_text": "832Q+RXJ Mya Yagon Project",
                "secondary_text": "Taik Kyi, Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
            "description": "Htape TannOo, Yagon, to Madalay Road, Phyu 08141, Myanmar",
            "place_id": "2662985",
            "reference": "2662985",
            "structured_formatting": {
                "main_text": "Htape TannOo",
                "secondary_text": "Yagon, to Madalay Road, Phyu 08141, Myanmar"
            },
            "terms": [],
            "types": []
        },
        {
Parameter Description Example
predictions An array containing a list of suggested places matching the user’s input. Each element includes information such as: description (full name), structured_formatting (name structure including main_text (primary name) and secondary_text (additional details)
{

   “description”: “Shwedagon Pagoda, Yangon, Myanmar”,

   “place_id”: “1234567890abcdefgHIJKLMNopqrstUVWXYZ“,

   “reference”: “abcdefg1234567890HIJKLMNopqrstUVWXYZ”,

   “structured_formatting”:…

…
description The location returned from the search. Shwedagon Pagoda, Yangon, Myanmar
matched_substrings Parts of the original search string or portions of a location that match the results returned by the API {

“length”: 2,

“offset”: 0

}

place_id A unique identifier for a location in the system provided by Goong. This ID can be used to retrieve detailed information about the address using the Place Detail API or Geocode API. 1234567890abcdefgHIJKLMNopqrstUVWXYZ
reference A string representing a unique location on the map. abcdefg1234567890HIJKLMNopqrstUVWXYZ
structured_formatting   Contains formatted information of the location (including main and additional information), which helps display location suggestions in a user-friendly manner. {

“main_text”: “Inle Lake”, “secondary_text”: “Shan State, Myanmar”

}

main_text The primary name of the location found.. Inle Lake
secondary_text Contains additional details about the geographic position or area of the location (main_text). Shan State, Myanmar
terms An array containing objects with keywords describing the location (value) and the position of the word (offset).. {

“offset”: 7,

“value”: “Yangon”

}

 

has_children Information about sub-locations. If the value is true, the place_id can be used to fetch child locations (e.g., gates within an airport) via the Child ID API true
display_type Provides information about the display type of a location or the returned result expand0
score Attributes are often used to represent the relevance or accuracy of the result compared to the user’s query, helping rank search results to show the most relevant ones at the top. 700.0
compound_code A local code combined with the area code, allowing precise identification of a specific geographic location +V63 Yangon, Myanmar
global_code A global code that can identify a location precisely at the city or area level. MMR+V63

LIMITING AUTOCOMPLETE SUGGESTIONS

By default, the Autocomplete feature displays all locations related to the search terms. This broad range may lead to suggestions that are less relevant. To improve the relevance of results, you can apply location-specific restrictions to the suggestions provided by the Autocomplete API.

Limiting results ensures the Autocomplete feature ignores locations outside the designated area. A common method is to restrict results to a specific radius. This ensures that Autocomplete suggestions are confined to a specific geographical area.

Methods to Limit Results:

  • Radius Restriction (radius): Limit search results within a certain radius.
  • Search Suggestions Around a Specific Location (location): Prioritize results near a specified geographical coordinate.

Example:

When the user inputs “aqua” without applying location restrictions:

'https://api.mapfusion.io/v1/place/autocomplete?input=aqua&api_key={YOUR_API_KEY}'

Result:

The API prioritizes suggestions near Yangon, Myanmar, as it assumes no additional filters:

{
   "predictions": [
       {
          "description": "Aqua Yangon, Kabar Aye Pagoda Road, Yangon, Myanmar",
          "place_id": "PLACE_ID_1",
          "reference": "REFERENCE_1",
          "structured_formatting": {
             "main_text": "Aqua Yangon",
             "secondary_text": "Kabar Aye Pagoda Road, Yangon, Myanmar"
         }
       },
       {
          "description": "AQUA Hotel, Insein Road, Hlaing Township, Yangon, Myanmar",
          "place_id": "PLACE_ID_2",
          "reference": "REFERENCE_2",
          "structured_formatting": {
             "main_text": "AQUA Hotel",
             "secondary_text": "Insein Road, Hlaing Township, Yangon, Myanmar"
          }
       }
   ],
   "execution_time": "",
   "status": "OK"
}

When the user enters a search term such as “aqua” along with a specific location (e.g., Yangon, Myanmar coordinates) and radius (e.g., 10 km):

https://api.mapfusion.io/v1/place/autocomplete?input=aqua&api_key={YOUR_API_KEY}&location=16.840853%2C%20196.731385&radius=10

Result:

The API returns results located within a 10 km radius around the provided coordinates in Yangon, Myanmar:

{
   "predictions": [
        {
            "description": "Aqua Clinic, 67 32nd Street, Botahtaung, Yangon",
            "place_id": "PLACE_ID_1",
            "reference": "REFERENCE_1",
            "structured_formatting": {
                "main_text": "Aqua Clinic",
                "secondary_text": "67 32nd Street, Botahtaung, Yangon"
            }
        },
        {
            "description": "Aqua Day Spa, Sule Shangri-La Hotel, 223 Sule Pagoda Road, Kyauktada, Yangon",
            "place_id": "PLACE_ID_2",
            "reference": "REFERENCE_2",
            "structured_formatting": {
                "main_text": "Aqua Day Spa",
                "secondary_text": "Sule Shangri-La Hotel, 223 Sule Pagoda Road, Kyauktada, Yangon"
            }
        },
        {
            "description": "Aqua Sports Wear, Yangon Yangon Tower, 24th Street, Lanmadaw, Yangon",
            "place_id": "PLACE_ID_3",
            "reference": "REFERENCE_3",
            "structured_formatting": {
                "main_text": "Aqua Sports Wear",
                "secondary_text": "Yangon Yangon Tower, 24th Street, Lanmadaw, Yangon"
            }
        },
        {
            "description": "Aqua Hotel, 25 Pansodan Street, Pabedan, Yangon",
            "place_id": "PLACE_ID_4",
            "reference": "REFERENCE_4",
            "structured_formatting": {
                "main_text": "Aqua Hotel",
                "secondary_text": "25 Pansodan Street, Pabedan, Yangon"
            }
        },
        {
            "description": "Aquarium Cafe, 1117 7th Street, Dagon Township, Yangon",
            "place_id": "PLACE_ID_5",
            "reference": "REFERENCE_5",
            "structured_formatting": {
                "main_text": "Aquarium Cafe",
                "secondary_text": "1117 7th Street, Dagon Township, Yangon"
            }
        }
   ],
   "execution_time": "10ms",
   "status": "OK"
}

Conclusion

MapFusion’s Autocomplete API enhances the user experience by providing real-time location suggestions, improving search efficiency, and reducing input errors. With seamless integration across multiple platforms, it ensures a smooth and intuitive workflow, making it ideal for ride-hailing, delivery services, and enterprise applications. Unlock the power of MapFusion’s extensive, high-performance location database today!