Shubham Verma
Shubham Verma

Reputation: 25

Python Folium maps with label and marker

I was trying to learn the folium and tried to put markers and label around my area. But I'm getting an error on line22. I'm not able to resolve that.

File "ipython-input-43-4e44e7187a3d", line 22 home_map.add_child(home) ^ SyntaxError: invalid syntax

Any leads would be appreciated.

#Home with intial zoom
import numpy as np  # useful for many scientific computing in Python
import pandas as pd # primary data structure library
import folium
#define My Home's geolocation coordinates
home_latitude = 28.000000
home_longitude = 77.000000

# define the world map centered around Canada with a higher zoom level
home_map = folium.Map(location=[home_latitude, home_longitude], zoom_start=15, tiles='Stamen Terrain')

home = folium.map.FeatureGroup()

home.add_child(folium.features.CircleMarker(
            [home_latitude, home_longitude],
            radius=5, # define how big you want the circle markers to be
            color='yellow',
            fill=True,
            fill_color='blue',
            fill_opacity=0.6)

home_map.add_child(home)

#label the marker
folium.Marker([home_latitude, home_longitude], popup= 'Home').add_to(home_map)
# display world map
home_map

Upvotes: 1

Views: 2373

Answers (1)

Mohit Chandel
Mohit Chandel

Reputation: 1916

You forgot to add one )

home.add_child(folium.features.CircleMarker(
        [home_latitude, home_longitude],
        radius=5, # define how big you want the circle markers to be
        color='yellow',
        fill=True,
        fill_color='blue',
        fill_opacity=0.6
        ) #<= here
        )

Upvotes: 1

Related Questions