Skip to content

Commit 508ef8c

Browse files
[Fixes #13719] Upsert with authority different that 4326 raise error
1 parent e38a7a2 commit 508ef8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

geonode/upload/handlers/common/vector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,11 @@ def _validate_feature(self, data_chunk, model_instance, upsert_key, errors):
13121312
# need to simulate the "promote to multi" used by the upload process.
13131313
# here we cannot rely on ogr2ogr so we need to do it manually
13141314
geom = feature.GetGeometryRef()
1315-
feature_as_dict.update({self.default_geometry_column_name: self.promote_geom_to_multi(geom).ExportToWkt()})
1315+
if geom:
1316+
wkt = self.promote_geom_to_multi(geom).ExportToWkt()
1317+
if code := geom.GetSpatialReference().GetAuthorityCode(None):
1318+
wkt = f"SRID={code};{wkt}"
1319+
feature_as_dict.update({self.default_geometry_column_name: wkt})
13161320

13171321
feature_as_dict, is_valid = self.validate_feature(feature_as_dict)
13181322
if not is_valid:

0 commit comments

Comments
 (0)