从folium map - iPython上的数据框绘制纬度经度点 [英] plot Latitude longitude points from dataframe on folium map - iPython

查看:2023
本文介绍了从folium map - iPython上的数据框绘制纬度经度点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带lat / lon坐标的数据框

I have a dataframe with lat/lon coordinates

latlon
(51.249443914705175, -0.13878830247011467)
(51.249443914705175, -0.13878830247011467)
(51.249768239976866, -2.8610415615063034)
...

我想将这些绘制到Folium地图上,但我不确定如何遍历每一行。

I would like to plot these on to a Folium map but I'm not sure of how to iterate through each of the rows.

任何帮助都将受到赞赏,提前致谢!

any help would be appreciated, Thanks in advance!

推荐答案

这可以解决您的问题

import folium
mapit = None
latlon = [ (51.249443914705175, -0.13878830247011467), (51.249443914705175, -0.13878830247011467), (51.249768239976866, -2.8610415615063034)]
for coord in latlon:
    mapit = folium.Map( location=[ coord[0], coord[1] ] )

mapit.save( 'map.html')



编辑(使用标记)



Edit (using marker)

import folium
latlon = [ (51.249443914705175, -0.13878830247011467), (51.249443914705175, -0.13878830247011467), (51.249768239976866, -2.8610415615063034)]
mapit = folium.Map( location=[52.667989, -1.464582], zoom_start=6 )
for coord in latlon:
    folium.Marker( location=[ coord[0], coord[1] ], fill_color='#43d9de', radius=8 ).add_to( mapit )

mapit.save( 'map.html')

如果您使用此引用,那就太棒了: https://github.com/python-visualization/folium

It'd be great if you use this reference: https://github.com/python-visualization/folium

这篇关于从folium map - iPython上的数据框绘制纬度经度点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆