Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2aa625a6ac | |||
| d39e758df4 |
@@ -156,6 +156,8 @@ class AbstractModelAPISerializer:
|
|||||||
if isinstance(geojson, dict):
|
if isinstance(geojson, dict):
|
||||||
geojson = json.dumps(geojson)
|
geojson = json.dumps(geojson)
|
||||||
geometry = geos.fromstr(geojson)
|
geometry = geos.fromstr(geojson)
|
||||||
|
if not geometry.valid:
|
||||||
|
raise ValueError(f"Invalid geometry: {geometry.valid_reason}")
|
||||||
is_4326 = Geometry.is_valid_4326(geometry)
|
is_4326 = Geometry.is_valid_4326(geometry)
|
||||||
if not is_4326:
|
if not is_4326:
|
||||||
raise ValueError("Geometry not in EPSG:4326 (WGS84). Unknown spatial reference system.")
|
raise ValueError("Geometry not in EPSG:4326 (WGS84). Unknown spatial reference system.")
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 16.07.26
|
||||||
|
|
||||||
|
"""
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 16.07.26
|
||||||
|
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user