How to Plot the Google Map using folium package in Python
Required Module and Libraries
Folium: The user can install the Folium package by using the following command.
Geopy: The geopy module of Python makes it easy for Python users to locate the coordinates of landmarks, cities, countries on the earth's surface. For installing the geopy module, the user can use the following command:
After successful installation of the both libraries, we follow the below steps to plot Google map.
Step 1: Create the Base map
The user can create the base map by using the following program:
Step 2: Add a Circular Marker
The user can mark the area with the circle and popup text by using the following code:
Step 3: Add the simple marker for the parachute style marker with the popup text
The user can use the following code.
Step 4: Add the line on the map
The user can use the following code for adding the line on the map to join the two coordinates.
We used the geopy library to get the latitude and longitude of the location. Then we used the "folium.map" method of the folium package for creating the base of Google Maps.
In step 2, we used "folium.CircleMarker" for marking the circular mark on the location with the pop-up text. In step 3, we used "folium.Marker" to add a parachute style mark on the mentioned location. In the last step, we used "folium.PolyLine" for joining two marks on two different locations on the map.
In this tutorial, we have shown how the user can Plot the Google map and add different required functionalities on the map like a circular mark, parachute mark, pop-up text, and the line joining the two coordinates on the map.
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week