How to add location search autocomplete functionality to your website in 2 minutes using Barikoi.js

Barikoi
2 min readMar 19, 2019
Photo by Sylwia Bartyzel on Unsplash

Over the last few years, peoples’ online presence and activities have increased exponentially and as a result, the to-the-point user experience is becoming quite a necessity. Location is one of the core parts of today’s digital world. Precise location data improves user experience, optimizes, and automates the distribution channel; be it ride-sharing, e-commerce, or food delivery. Companies are being benefitted financially and are able to save more time simultaneously.

Barikoi autocomplete API provides reliable location data in various formats, such as REST API and a library for quick integration as well, called barikoi.js.

In today’s article, we will demonstrate how to write a simple demo to show how to integrate location autocomplete functionality in any website in just a few minutes.

Getting Started

Firstly, it is required to create a barikoi account at https://barikoi.com/signup. Then generate an API key from the account dashboard. Next, add barikoi.js and barikoi.css on your page with the generated API key (barikoi.js only).

Results after adding barikoi files

Barikoi.js

Barikoi.css

In order to get the Barikoi autocomplete feature working, you have to create an input field with the class name of ‘bksearch’ and a div with a class name of ‘bklist’. Wrap both with a div. Now you will get the autocomplete list every time you search. Here is the HTML example.

Now getting the selected data is simple as well.

Add Map Layer

We can visualize this data on any map e,g. Google maps or OpenStreetMap, Mapbox. Here we have used OpenStreetMap as an example.

We are done binding the map with barikoi.js and ready to use it

This is how it will look like when compiled together

Happy Coding!

--

--

Barikoi

Bangladesh’s Hyperlocal Full Stack Location Platform