python - 带有标签和标记的 Python Folium 地图
问题描述
我试图学习叶子,并试图在我的区域周围放置标记和标签。但我在第 22 行遇到错误。我无法解决这个问题。
文件“ipython-input-43-4e44e7187a3d”,第 22 行 home_map.add_child(home) ^ SyntaxError: invalid syntax
任何线索将不胜感激。
#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
解决方案
你忘了加一个)
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
)
推荐阅读
- python - 在关系数据库中创建二进制列的好方法?
- java - JAVA获取文件修改时间并删除
- java - 如何在 listView 中做两个文本块,第一个在左对齐,第二个在右对齐?
- sql - 如何在 sql 中生成非常大的数组
- cassandra - 如何更改 cassandra.yaml 文件并重启 cassandra 集群?
- c++ - 当头文件的文件夹位于同一目录中时检测到包含错误?
- angular - 找不到构建器 @angular-devkit/build-angular:dev-server 的实现
- google-app-engine - 如何在 Google NLP 情感分析中正确训练模型
- javascript - 使用组件内的选择器将主题/样式应用于所有 html/react 标签
- powershell - ConvertFrom-String 返回符号而不是文本