GIS计算点与多边形/边界之间的距离 [英] gis calculate distance between point and polygon / border
问题描述
我想使用python/
根据 geopandas 文档,GeoSeries是几何的矢量(在您的情况下, 0(POLYGON ...
告诉您只有一个对象,但它仍然是矢量).应该有一种获取第一个几何的方法元素.GeoSeries类实现了 __ getitem __
方法,因此 austriaBorders.geometry [0]
应该会为您提供所需的几何.因此,请尝试使用 point.distance(austriaBorders.geometry [0])
.
如果只需要到一个点的距离,则 GeoSeries
实现了 distance
方法,但是它将返回一个包含到每个包含的几何图形的距离的向量(根据文档).
I want to calculate the distance between a point and the border of a country using python / shapely
. It should work just fine point.distance(poly) e.g. demonstrated here Find Coordinate of Closest Point on Polygon Shapely but using geopandas
I face the issue of:
'GeoSeries' object has no attribute '_geom'
What is wrong in my handling of the data? My border dataset is from http://www.gadm.org/
According to geopandas documentation, a GeoSeries is a vector of geometries (in your case, 0 (POLYGON...
tells that you have just one object, but it is still a vector). There should be a way of getting the first geometry element. GeoSeries class implements the __getitem__
method, so austriaBorders.geometry[0]
should give you the geometry you need. So, try with point.distance(austriaBorders.geometry[0])
.
If you only need the distance to a point, the GeoSeries
has the distance
method implemented, but it will return a vector with the distance to each geometry it contains (according to documentation).
这篇关于GIS计算点与多边形/边界之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!