1
我從谷歌地圖方向api計算線串。 我將線串轉換爲GEOSGeometry對象。我需要另一個區域,它覆蓋線串對象距離'd'的所有點。 距離以米,公里爲單位。 GEOS API提供了GEOSGeometry.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
# ???