# Error fetching
* adds proper fetching of GDAL Exceptions in case of further problems in the future
This commit is contained in:
@@ -9,6 +9,7 @@ import json
|
|||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from django.contrib.gis import gdal
|
||||||
|
|
||||||
from konova.sub_settings import schneider_settings
|
from konova.sub_settings import schneider_settings
|
||||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID
|
from konova.sub_settings.lanis_settings import DEFAULT_SRID
|
||||||
@@ -35,7 +36,10 @@ class ParcelFetcher:
|
|||||||
if geom.area < buffer_threshold:
|
if geom.area < buffer_threshold:
|
||||||
# Fallback for malicious geometries which are way too small and would disappear on negative buffering
|
# Fallback for malicious geometries which are way too small and would disappear on negative buffering
|
||||||
geom = geometry.geom
|
geom = geometry.geom
|
||||||
|
try:
|
||||||
geom.transform(DEFAULT_SRID)
|
geom.transform(DEFAULT_SRID)
|
||||||
|
except gdal.GDALException as e:
|
||||||
|
raise ValueError(f"{str(e)}\nCould not transform geometry (id: {geometry.id}) to {DEFAULT_SRID}:\n {geom.geojson}")
|
||||||
self.geojson = geom.ewkt
|
self.geojson = geom.ewkt
|
||||||
self.results = []
|
self.results = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user