from django.contrib.gis.geos import LinearRing
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.gdal import SpatialReference, CoordTransform
from django.contrib.gis.geos import Polygon
#transformation of coordinates
lring = LinearRing(//tuple with point coordinates//)
#example SRID 4326 to 32719
coord = SpatialReference(4326)
mycoord = SpatialReference(32719)
trans = CoordTransform(mycoord, coord)
linear_r = GEOSGeometry(lring).coords
#then create polygon from linear ring
polygon = Polygon(linear_r)
1条答案
按热度按时间e1xvtsh31#
首先,您需要将这些坐标转换为米(如果以度为单位),然后创建一个线性环以插入到多边形对象中
线性环具有相同的第一个和最后一个点坐标来闭合环