简体   繁体   English

Python绘制城市地图上的点

[英]Python plotting points on a city map

I am not really familiar with GIS systems in python. 我对python中的GIS系统并不熟悉。 I am looking for a library to do the following: 我正在寻找一个库来执行以下操作:

Lets say I have a pandas data frame with one column of street addresses and another of labeled categorical or numerical data. 假设我有一个大熊猫数据框,其中包含一列街道地址和另一列标记的分类或数字数据。 Something like the following for San Francisco: 旧金山的情况如下:

df=pd.DataFrame({'Location': ['1 Dr Carlton B Goodlett Place','1390 Market Street','1100 Fillmore St' ],
                 'Type': ['G', 'G','C']})

And I want to plot them on a map of San Francisco with the 'Type' column being in red for the data in 'G' and blue for 'C'. 我想将它们绘制在旧金山的地图上,“类型”列为红色,表示“G”数据,蓝色表示“C”。 How would I a simple plot like this? 我怎么会这样一个简单的情节? How would I also include streets on the map? 我怎么还在地图上包括街道? Can an simple example be provided? 可以提供一个简单的例子吗?

I found a library called Geopy to change the data to longitude & latitude if it helps to convert the data. 我找到了一个名为Geopy的库,如果有助于转换数据,可以将数据更改为经度和纬度。 Also read that matplotlib can do this with basemap but it is for areas larger than cities. 另请阅读matplotlib可以使用basemap执行此操作,但它适用于大于城市的区域。

There are tons of ways to plot data in a map. 有很多方法可以在地图中绘制数据。 The geopy lib includes geocoding libraries to convert addresses to gps coordinates but you still need to take a look at the license (for example google asks you to buy a license or only use the service with their maps). geopy lib包括地理编码库,用于将地址转换为gps坐标,但您仍需要查看许可证(例如,Google要求您购买许可证或仅将服务与其地图一起使用)。 An easy way to obtain a map background is using a free tile service here are some useful urls: 获取地图背景的简单方法是使用免费磁贴服务,这里有一些有用的网址:

http://leafletjs.com/ ("free" js library for plotting) http://leafletjs.com/ (用于绘图的“免费”js库)

http://www.openstreetmap.org/ ("free" background maps) http://www.openstreetmap.org/ (“免费”背景图)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM