如何在python中的坐标周围创建5英里的准确缓冲区? [英] How to create an accurate buffer of 5 miles around a coordinate in python?

查看:194
本文介绍了如何在python中的坐标周围创建5英里的准确缓冲区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个坐标周围创建一个5英里的准确缓冲区,我当前的代码是:

I would like to create an accurate buffer of 5 miles around a coordinate, my current code is:

cpr_gdf['p_buffer']=cpr_gdf['coordinates'].buffer(5*(1/60))

使用以下代码创建坐标列:

The coordinates column was created with this code:

cpr_df['coordinates']=list(zip(cpr_df.sample_longitude_decimal,cpr_df.sample_latitude_decimal))
cpr_df['coordinates']=cpr_df['coordinates'].apply(Point)
cpr_gdf=gpd.GeoDataFrame(cpr_df,geometry='coordinates',crs={'init' :'epsg:4326'})

感谢您的帮助!

推荐答案

您需要转换为最准确地等于缓冲区所在位置的等面积投影(位于

You need to convert to an equal area projection that is most accurate to where your buffer will be (good resource at https://epsg.io/)

例如,我正在密歇根州制作地图,所以我使用的是EPSG:3174(我相信它是米制的,如果有误,请更正我).既然您已经将数据框转换为GeoPandas数据框,则可以将当前的投影转换为3174,然后创建缓冲区(将英里转换为米)

For example, I'm making maps in Michigan, so I'm using EPSG:3174 (which I believe is in meters, correct me if wrong). Given you've already converted your dataframe to a GeoPandas dataframe, you can convert your current projection to 3174 and then create your buffer (converting miles to meters)

cpr_gdf= cpr_gdf.to_crs({'init': 'epsg:3174'})  
buffer_length_in_meters = (5 * 1000) * 1.60934
cpr_gdf['geometry'] = cpr_gdf.geometry.buffer(buffer_length_in_meters)

这篇关于如何在python中的坐标周围创建5英里的准确缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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