mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Refs #35058 -- Added support for measured geometries to GDAL LineString.
This commit is contained in:
committed by
Mariusz Felisiak
parent
41aaf5aafa
commit
1df8983aa3
@@ -625,10 +625,14 @@ class LineString(OGRGeometry):
|
||||
def __getitem__(self, index):
|
||||
"Return the Point at the given index."
|
||||
if 0 <= index < self.point_count:
|
||||
x, y, z = c_double(), c_double(), c_double()
|
||||
capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))
|
||||
x, y, z, m = c_double(), c_double(), c_double(), c_double()
|
||||
capi.get_point(self.ptr, index, byref(x), byref(y), byref(z), byref(m))
|
||||
if self.is_3d and self.is_measured:
|
||||
return x.value, y.value, z.value, m.value
|
||||
if self.is_3d:
|
||||
return x.value, y.value, z.value
|
||||
if self.is_measured:
|
||||
return x.value, y.value, m.value
|
||||
dim = self.coord_dim
|
||||
if dim == 1:
|
||||
return (x.value,)
|
||||
@@ -673,6 +677,12 @@ class LineString(OGRGeometry):
|
||||
if self.is_3d:
|
||||
return self._listarr(capi.getz)
|
||||
|
||||
@property
|
||||
def m(self):
|
||||
"""Return the M coordinates in a list."""
|
||||
if self.is_measured:
|
||||
return self._listarr(capi.getm)
|
||||
|
||||
|
||||
# LinearRings are used in Polygons.
|
||||
class LinearRing(LineString):
|
||||
@@ -789,9 +799,11 @@ GEO_CLASSES = {
|
||||
7: GeometryCollection,
|
||||
101: LinearRing,
|
||||
2001: Point, # POINT M
|
||||
2002: LineString, # LINESTRING M
|
||||
3001: Point, # POINT ZM
|
||||
3002: LineString, # LINESTRING ZM
|
||||
1 + OGRGeomType.wkb25bit: Point, # POINT Z
|
||||
2 + OGRGeomType.wkb25bit: LineString,
|
||||
2 + OGRGeomType.wkb25bit: LineString, # LINESTRING Z
|
||||
3 + OGRGeomType.wkb25bit: Polygon,
|
||||
4 + OGRGeomType.wkb25bit: MultiPoint,
|
||||
5 + OGRGeomType.wkb25bit: MultiLineString,
|
||||
|
||||
@@ -137,8 +137,15 @@ get_geom_name = const_string_output(
|
||||
get_geom_type = int_output(lgdal.OGR_G_GetGeometryType, [c_void_p])
|
||||
get_point_count = int_output(lgdal.OGR_G_GetPointCount, [c_void_p])
|
||||
get_point = void_output(
|
||||
lgdal.OGR_G_GetPoint,
|
||||
[c_void_p, c_int, POINTER(c_double), POINTER(c_double), POINTER(c_double)],
|
||||
lgdal.OGR_G_GetPointZM,
|
||||
[
|
||||
c_void_p,
|
||||
c_int,
|
||||
POINTER(c_double),
|
||||
POINTER(c_double),
|
||||
POINTER(c_double),
|
||||
POINTER(c_double),
|
||||
],
|
||||
errcheck=False,
|
||||
)
|
||||
geom_close_rings = void_output(lgdal.OGR_G_CloseRings, [c_void_p], errcheck=False)
|
||||
|
||||
Reference in New Issue
Block a user