mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Refs #35058 -- Added support for measured geometries to GDAL GeometryCollection and subclasses.
This commit is contained in:
parent
f8ff61c77e
commit
222bf2932b
@ -801,14 +801,22 @@ GEO_CLASSES = {
|
|||||||
2001: Point, # POINT M
|
2001: Point, # POINT M
|
||||||
2002: LineString, # LINESTRING M
|
2002: LineString, # LINESTRING M
|
||||||
2003: Polygon, # POLYGON M
|
2003: Polygon, # POLYGON M
|
||||||
|
2004: MultiPoint, # MULTIPOINT M
|
||||||
|
2005: MultiLineString, # MULTILINESTRING M
|
||||||
|
2006: MultiPolygon, # MULTIPOLYGON M
|
||||||
|
2007: GeometryCollection, # GEOMETRYCOLLECTION M
|
||||||
3001: Point, # POINT ZM
|
3001: Point, # POINT ZM
|
||||||
3002: LineString, # LINESTRING ZM
|
3002: LineString, # LINESTRING ZM
|
||||||
3003: Polygon, # POLYGON ZM
|
3003: Polygon, # POLYGON ZM
|
||||||
|
3004: MultiPoint, # MULTIPOINT ZM
|
||||||
|
3005: MultiLineString, # MULTILINESTRING ZM
|
||||||
|
3006: MultiPolygon, # MULTIPOLYGON ZM
|
||||||
|
3007: GeometryCollection, # GEOMETRYCOLLECTION ZM
|
||||||
1 + OGRGeomType.wkb25bit: Point, # POINT Z
|
1 + OGRGeomType.wkb25bit: Point, # POINT Z
|
||||||
2 + OGRGeomType.wkb25bit: LineString, # LINESTRING Z
|
2 + OGRGeomType.wkb25bit: LineString, # LINESTRING Z
|
||||||
3 + OGRGeomType.wkb25bit: Polygon, # POLYGON Z
|
3 + OGRGeomType.wkb25bit: Polygon, # POLYGON Z
|
||||||
4 + OGRGeomType.wkb25bit: MultiPoint,
|
4 + OGRGeomType.wkb25bit: MultiPoint, # MULTIPOINT Z
|
||||||
5 + OGRGeomType.wkb25bit: MultiLineString,
|
5 + OGRGeomType.wkb25bit: MultiLineString, # MULTILINESTRING Z
|
||||||
6 + OGRGeomType.wkb25bit: MultiPolygon,
|
6 + OGRGeomType.wkb25bit: MultiPolygon, # MULTIPOLYGON Z
|
||||||
7 + OGRGeomType.wkb25bit: GeometryCollection,
|
7 + OGRGeomType.wkb25bit: GeometryCollection, # GEOMETRYCOLLECTION Z
|
||||||
}
|
}
|
||||||
|
@ -81,10 +81,11 @@ Minor features
|
|||||||
|
|
||||||
* :class:`~django.contrib.gis.gdal.OGRGeometry`,
|
* :class:`~django.contrib.gis.gdal.OGRGeometry`,
|
||||||
:class:`~django.contrib.gis.gdal.Point`,
|
:class:`~django.contrib.gis.gdal.Point`,
|
||||||
:class:`~django.contrib.gis.gdal.LineString`, and
|
:class:`~django.contrib.gis.gdal.LineString`,
|
||||||
:class:`~django.contrib.gis.gdal.Polygon` now support measured geometries
|
:class:`~django.contrib.gis.gdal.Polygon`, and
|
||||||
via the new :attr:`.OGRGeometry.is_measured` and ``m`` properties, and the
|
:class:`~django.contrib.gis.gdal.GeometryCollection` and its subclasses now
|
||||||
:meth:`.OGRGeometry.set_measured` method.
|
support measured geometries via the new :attr:`.OGRGeometry.is_measured` and
|
||||||
|
``m`` properties, and the :meth:`.OGRGeometry.set_measured` method.
|
||||||
|
|
||||||
* :attr:`.OGRGeometry.centroid` is now available on all supported geometry
|
* :attr:`.OGRGeometry.centroid` is now available on all supported geometry
|
||||||
types.
|
types.
|
||||||
|
@ -675,10 +675,10 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin):
|
|||||||
("Point M", 2001, True),
|
("Point M", 2001, True),
|
||||||
("LineString M", 2002, True),
|
("LineString M", 2002, True),
|
||||||
("Polygon M", 2003, True),
|
("Polygon M", 2003, True),
|
||||||
("MultiPoint M", 2004, False),
|
("MultiPoint M", 2004, True),
|
||||||
("MultiLineString M", 2005, False),
|
("MultiLineString M", 2005, True),
|
||||||
("MultiPolygon M", 2006, False),
|
("MultiPolygon M", 2006, True),
|
||||||
("GeometryCollection M", 2007, False),
|
("GeometryCollection M", 2007, True),
|
||||||
("CircularString M", 2008, False),
|
("CircularString M", 2008, False),
|
||||||
("CompoundCurve M", 2009, False),
|
("CompoundCurve M", 2009, False),
|
||||||
("CurvePolygon M", 2010, False),
|
("CurvePolygon M", 2010, False),
|
||||||
@ -690,10 +690,10 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin):
|
|||||||
("Point ZM", 3001, True),
|
("Point ZM", 3001, True),
|
||||||
("LineString ZM", 3002, True),
|
("LineString ZM", 3002, True),
|
||||||
("Polygon ZM", 3003, True),
|
("Polygon ZM", 3003, True),
|
||||||
("MultiPoint ZM", 3004, False),
|
("MultiPoint ZM", 3004, True),
|
||||||
("MultiLineString ZM", 3005, False),
|
("MultiLineString ZM", 3005, True),
|
||||||
("MultiPolygon ZM", 3006, False),
|
("MultiPolygon ZM", 3006, True),
|
||||||
("GeometryCollection ZM", 3007, False),
|
("GeometryCollection ZM", 3007, True),
|
||||||
("CircularString ZM", 3008, False),
|
("CircularString ZM", 3008, False),
|
||||||
("CompoundCurve ZM", 3009, False),
|
("CompoundCurve ZM", 3009, False),
|
||||||
("CurvePolygon ZM", 3010, False),
|
("CurvePolygon ZM", 3010, False),
|
||||||
@ -943,6 +943,30 @@ class OGRGeomTest(SimpleTestCase, TestDataMixin):
|
|||||||
geom.shell.wkt, "LINEARRING (0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)"
|
geom.shell.wkt, "LINEARRING (0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_multi_geometries_m_dimension(self):
|
||||||
|
tests = [
|
||||||
|
"MULTIPOINT M ((10 40 10), (40 30 10), (20 20 10))",
|
||||||
|
"MULTIPOINT ZM ((10 40 0 10), (40 30 1 10), (20 20 1 10))",
|
||||||
|
"MULTILINESTRING M ((10 10 1, 20 20 2),(40 40 1, 30 30 2))",
|
||||||
|
"MULTILINESTRING ZM ((10 10 0 1, 20 20 0 2),(40 40 1, 30 30 0 2))",
|
||||||
|
(
|
||||||
|
"MULTIPOLYGON ZM (((30 20 1 0, 45 40 1 0, 30 20 1 0)),"
|
||||||
|
"((15 5 0 0, 40 10 0 0, 15 5 0 0)))"
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"GEOMETRYCOLLECTION M (POINT M (40 10 0),"
|
||||||
|
"LINESTRING M (10 10 0, 20 20 0, 10 40 0))"
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"GEOMETRYCOLLECTION ZM (POINT ZM (40 10 0 1),"
|
||||||
|
"LINESTRING ZM (10 10 1 0, 20 20 1 0, 10 40 1 0))"
|
||||||
|
),
|
||||||
|
]
|
||||||
|
for geom_input in tests:
|
||||||
|
with self.subTest(geom_input=geom_input):
|
||||||
|
geom = OGRGeometry(geom_input)
|
||||||
|
self.assertIs(geom.is_measured, True)
|
||||||
|
|
||||||
|
|
||||||
class DeprecationTests(SimpleTestCase):
|
class DeprecationTests(SimpleTestCase):
|
||||||
def test_coord_setter_deprecation(self):
|
def test_coord_setter_deprecation(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user