我有一个问题,我想知道一个大地测量点是否落在美国境内。我找到了this great data source,它有美国边界、州和县。州和县以Polygon或MultiPolygon的形式给出,这使得调用polygon.contains(point)很容易,但美国边界以一系列LineString的形式给出
import fiona
from shapely.geometry import shape
from shapely.ops import unary_union
uu_mp = unary_union([shape(poly['geometry']) for poly in fiona.open('gz_2010_us_040_00_500k.shp')])
uu_mp
US outline.shp是线字符串,因为它们不包含整个US outline
若你们想得到一个多边形,对于我们所有人来说,你们可以和美国各州一起做
如果要使用状态的子集,可以这样做
对于形状优美的解决方案,您可以这样做
相关问题 更多 >
编程相关推荐