如何从邮政编码生成shapely表单?

2024-06-30 15:29:42 发布

您现在位置:Python中文网/ 问答频道 /正文

例如,我创建了一个带有shapely和邮政编码的多点,并添加了一个0.01的缓冲区来获得一个区域,但是我如何找到如何设置适合于这些点或者每个单点的缓冲区呢?你知道吗

from shapely.geometry import MultiPoint
from geopy.geocoders import GoogleV3

geocoder = GoogleV3()
zipCodes = [12043, 12045, 12047, 12049, 12051, 12053, 12055, 12057, 12059]
country = 'Germany'

coordinates = list(map(lambda x: geocoder.geocode(str(x) + country), zipCodes))

coordinates = list(map(lambda x: (x.latitude, x.longitude), coordinates))

region = MultiPoint(coordinates)
region.buffer(0.01)

这就是该地区目前的情况:

That's how the region looks at the moment


Tags: lambdafromimportmapcountryregionlist缓冲区