mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Refs #35058 -- Made OGRGeomType aware of additional WKB geometry types.
This commit increases OGRGeomType's knowledge of WKB types and allows for improved error messages when Django doesn't yet have a corresponding class to wrap a given type.
This commit is contained in:
committed by
Mariusz Felisiak
parent
7c26dbf6ef
commit
21b0b23a67
@@ -123,7 +123,9 @@ class OGRGeometry(GDALBase):
|
||||
self.srs = srs
|
||||
|
||||
# Setting the class depending upon the OGR Geometry Type
|
||||
self.__class__ = GEO_CLASSES[self.geom_type.num]
|
||||
if (geo_class := GEO_CLASSES.get(self.geom_type.num)) is None:
|
||||
raise TypeError(f"Unsupported geometry type: {self.geom_type}")
|
||||
self.__class__ = geo_class
|
||||
|
||||
# Pickle routines
|
||||
def __getstate__(self):
|
||||
|
||||
@@ -16,9 +16,57 @@ class OGRGeomType:
|
||||
5: "MultiLineString",
|
||||
6: "MultiPolygon",
|
||||
7: "GeometryCollection",
|
||||
8: "CircularString",
|
||||
9: "CompoundCurve",
|
||||
10: "CurvePolygon",
|
||||
11: "MultiCurve",
|
||||
12: "MultiSurface",
|
||||
15: "PolyhedralSurface",
|
||||
16: "TIN",
|
||||
17: "Triangle",
|
||||
100: "None",
|
||||
101: "LinearRing",
|
||||
102: "PointZ",
|
||||
1008: "CircularStringZ",
|
||||
1009: "CompoundCurveZ",
|
||||
1010: "CurvePolygonZ",
|
||||
1011: "MultiCurveZ",
|
||||
1012: "MultiSurfaceZ",
|
||||
1013: "CurveZ",
|
||||
1014: "SurfaceZ",
|
||||
1015: "PolyhedralSurfaceZ",
|
||||
1016: "TINZ",
|
||||
1017: "TriangleZ",
|
||||
2001: "PointM",
|
||||
2002: "LineStringM",
|
||||
2003: "PolygonM",
|
||||
2004: "MultiPointM",
|
||||
2005: "MultiLineStringM",
|
||||
2006: "MultiPolygonM",
|
||||
2007: "GeometryCollectionM",
|
||||
2008: "CircularStringM",
|
||||
2009: "CompoundCurveM",
|
||||
2010: "CurvePolygonM",
|
||||
2011: "MultiCurveM",
|
||||
2012: "MultiSurfaceM",
|
||||
2015: "PolyhedralSurfaceM",
|
||||
2016: "TINM",
|
||||
2017: "TriangleM",
|
||||
3001: "PointZM",
|
||||
3002: "LineStringZM",
|
||||
3003: "PolygonZM",
|
||||
3004: "MultiPointZM",
|
||||
3005: "MultiLineStringZM",
|
||||
3006: "MultiPolygonZM",
|
||||
3007: "GeometryCollectionZM",
|
||||
3008: "CircularStringZM",
|
||||
3009: "CompoundCurveZM",
|
||||
3010: "CurvePolygonZM",
|
||||
3011: "MultiCurveZM",
|
||||
3012: "MultiSurfaceZM",
|
||||
3015: "PolyhedralSurfaceZM",
|
||||
3016: "TINZM",
|
||||
3017: "TriangleZM",
|
||||
1 + wkb25bit: "Point25D",
|
||||
2 + wkb25bit: "LineString25D",
|
||||
3 + wkb25bit: "Polygon25D",
|
||||
|
||||
@@ -10,7 +10,9 @@ wkt_regex = _lazy_re_compile(
|
||||
r"^(SRID=(?P<srid>\-?[0-9]+);)?"
|
||||
r"(?P<wkt>"
|
||||
r"(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|"
|
||||
r"MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)"
|
||||
r"MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION|CIRCULARSTRING|COMPOUNDCURVE|"
|
||||
r"CURVEPOLYGON|MULTICURVE|MULTISURFACE|CURVE|SURFACE|POLYHEDRALSURFACE|TIN|"
|
||||
r"TRIANGLE)"
|
||||
r"[ACEGIMLONPSRUTYZ0-9,.+() -]+)$",
|
||||
re.I,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user