我从googlemapsdirectionsapi计算了linestring。 我把线串转换成GeoGeometry对象。我需要另一个区域,覆盖距离linestring对象“d”的所有点。 距离以m,km为单位。 GEOS API提供geosometry.buffer(width,quadsegs=8)这样做在二维投影中效果很好。在
但对于球形模型,该怎么做呢?是否与SRID有关。在
from django.contrib.gis.geos import LineString
from django.contrib.gis.geos import GEOSGeometry
directions = maps_client.directions(source, destination)
overview_polyline = decode_polyline(directions[0]['overview_polyline'])
linestring_obj = LineString(overview_polyline)
# FOR 2-D projection
bounding_box = linestring_obj.buffer(width=100)
# For spherical model
# ???
为了使以米为单位的地理距离有意义,您必须始终通过投影坐标系,因此我建议您将数据转换为投影坐标系,创建缓冲区并将其投影回去。例如:
相关问题 更多 >
编程相关推荐