【问题标题】:Python Folium maps with label and marker带有标签和标记的 Python Folium 地图
【发布时间】:2021-02-09 09:35:10
【问题描述】:

我正在尝试学习大叶,并尝试在我的区域周围放置标记和标签。 但我在第 22 行遇到错误。 我无法解决这个问题。

文件“ipython-input-43-4e44e7187a3d”,第 22 行 home_map.add_child(家) ^ SyntaxError: 无效语法

任何线索将不胜感激。

#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

【问题讨论】:

    标签: python python-3.x maps folium


    【解决方案1】:

    您忘记添加一个)

    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
            )
    

    【讨论】:

    • 之后,又出现了 1 个错误。但它已解决。 folium.features.CircleMarker 更改为 folium.CircleMarker。
    猜你喜欢
    • 1970-01-01
    • 2019-05-22
    • 2015-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 1970-01-01
    相关资源
    最近更新 更多