Skip to content

Commit

Permalink
Add warning if CRS is not EPSG (currently not supported)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Kröger committed Feb 3, 2025
1 parent 921d569 commit d1668a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Discovery/gpkg_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osgeo import ogr, gdal
from qgis.core import QgsVectorLayer, QgsDataSourceUri, QgsFeatureRequest, QgsExpression
from qgis.core import QgsVectorLayer, QgsDataSourceUri, QgsFeatureRequest, QgsExpression, QgsMessageLog
from .utils import is_number


Expand Down Expand Up @@ -50,7 +50,11 @@ def search_gpkg(search_text, search_field, echo_search_column, display_fields, e
for f in it:
feature_info = []
geom = f.geometry().asWkt()
epsg = int(layer.crs().authid().lstrip("EPSG:")) # only the plain integer code is wanted later on
try:
epsg = int(layer.crs().authid().lstrip("EPSG:")) # only the plain integer code is wanted later on
except ValueError:
QgsMessageLog.logMessage(f"{layer.crs().authid()} is not an EPSG code.", "Discovery")
return []
feature_info.append(geom)
feature_info.append(epsg)
available_fields = [field.name() for field in f.fields()]
Expand Down

0 comments on commit d1668a5

Please sign in to comment.