Python绘制城市地图上的点

时间:2022-09-10 22:02:29

I am not really familiar with GIS systems in python. I am looking for a library to do the following:

我对python中的GIS系统并不熟悉。我正在寻找一个库来执行以下操作:

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:

假设我有一个pandas数据框,其中包含一列街道地址和另一列标记的分类或数字数据。旧金山的情况如下:

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'. How would I a simple plot like this? How would I also include streets on the map? Can an simple example be provided?

我想在旧金山的地图上绘制它们,“类型”列为红色,表示“G”数据,蓝色表示“C”。我怎么会这样一个简单的情节?我怎么还在地图上包括街道?可以提供一个简单的例子吗?

I found a library called Geopy to change the data to longitude & latitude if it helps to convert the data. Also read that matplotlib can do this with basemap but it is for areas larger than cities.

我找到了一个名为Geopy的库,如果有助于转换数据,可以将数据更改为经度和纬度。另请阅读matplotlib可以使用底图执行此操作,但它适用于大于城市的区域。

1 个解决方案

#1


2  

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). An easy way to obtain a map background is using a free tile service here are some useful urls:

有很多方法可以在地图中绘制数据。 geopy lib包括地理编码库,用于将地址转换为gps坐标,但您仍需要查看许可证(例如,Google要求您购买许可证或仅将服务与其地图一起使用)。获取地图背景的简单方法是使用免费的瓷砖服务,这里有一些有用的网址:

http://leafletjs.com/ ("free" js library for plotting)

http://leafletjs.com/(用于绘图的“免费”js库)

http://www.openstreetmap.org/ ("free" background maps)

http://www.openstreetmap.org/(“免费”背景地图)

#1


2  

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). An easy way to obtain a map background is using a free tile service here are some useful urls:

有很多方法可以在地图中绘制数据。 geopy lib包括地理编码库,用于将地址转换为gps坐标,但您仍需要查看许可证(例如,Google要求您购买许可证或仅将服务与其地图一起使用)。获取地图背景的简单方法是使用免费的瓷砖服务,这里有一些有用的网址:

http://leafletjs.com/ ("free" js library for plotting)

http://leafletjs.com/(用于绘图的“免费”js库)

http://www.openstreetmap.org/ ("free" background maps)

http://www.openstreetmap.org/(“免费”背景地图)