Google map alternative to embed map in websites

Rabin Poudyal
Mar 27 · 2 min read

Few months ago Google changed their policies on how to let users use their maps. It caused many problems for users who were using google maps. Even though they still have free service defined by their limits having to give credit card information ahead of time to use maps seems to be too much. So in this post I am going to write about an open source library which can do thing for us.

The one that I used recently was Leaflet. It is an open source JavaScript library for mobile friendly interactive maps. It is very minimal and contains all the features.

To use the map we just need to put these two tags in our head section

Then we can write following code to put the map in our code

Here first parameter of setView is array of latitude and longitude and second parameter is zoom level.

After initializing the map, we can simply add marker to map and if we want we can also put link of google maps. This will create the following output.

Which is what we want. We can also place multiple markers and make this map a lot better. I recommend you to visit leaflet website for more documentation.

If you like this post, don’t forget to clap the post and follow me on medium and on twitter.

Rabin Poudyal

Written by

Aspiring programmer. Say "hi" via email: rabinpoudyal1995@gmail.com or Follow me on twitter @poudyal_rabin