geonode
geonode copied to clipboard
Unclear error message "Unknown Error Occurred" when spatial reference is missing
Expected Behavior
GeoNode displays a clear error message in the form layer importer, when uploading a GeoTiff as new layer with missing spatial reference. In this case, I expected an error message like "No spatial reference found" or the exception message (see logs below for more details): "django.db.utils.InternalError: Cannot find SRID (404000) in spatial_ref_sys".
Actual Behavior
After uploading the file, when trying to save the edited metadata, an error dialog is shown with the error message: "Unknown Error Occurred".
The server log shows the following:
geonode | [pid: 266|app: 0|req: 6/45] 127.0.0.1 () {24 vars in 254 bytes} [Tue Jan 18 09:40:18 2022] GET / => generated 27463 bytes in 98 msecs (HTTP/1.1 200) 9 headers in 566 bytes (1 switches on core 0)
geonode | handling UUID In pre_save_layer
geonode | In pre_save_layer
geonode | instance.alternate is: geonode:Raw_20190819_1653140
geonode | OGR failure.
geonode | Internal Server Error: /layers/Raw_20190819_1653140:geonode:Raw_20190819_1653140/metadata
geonode | Traceback (most recent call last):
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
geonode | return self.cursor.execute(sql, params)
geonode | psycopg2.errors.InternalError_: Cannot find SRID (404000) in spatial_ref_sys
geonode |
geonode |
geonode | The above exception was the direct cause of the following exception:
geonode |
geonode | Traceback (most recent call last):
geonode | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
geonode | response = get_response(request)
geonode | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
geonode | response = self.process_exception_by_middleware(e, request)
geonode | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
geonode | response = wrapped_callback(request, *callback_args, **callback_kwargs)
geonode | File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
geonode | return view_func(request, *args, **kwargs)
geonode | File "/usr/local/lib/python3.8/site-packages/geonode/decorators.py", line 214, in _inner
geonode | return function(request, *args, **kwargs)
geonode | File "/usr/local/lib/python3.8/site-packages/geonode/layers/views.py", line 1118, in layer_metadata
geonode | layer.save(notify=True)
geonode | File "/usr/local/lib/python3.8/site-packages/geonode/base/models.py", line 1067, in save
geonode | super(ResourceBase, self).save(*args, **kwargs)
geonode | File "/usr/local/lib/python3.8/site-packages/polymorphic/models.py", line 91, in save
geonode | return super(PolymorphicModel, self).save(*args, **kwargs)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 743, in save
geonode | self.save_base(using=using, force_insert=force_insert,
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 779, in save_base
geonode | parent_inserted = self._save_parents(cls, using, update_fields)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 808, in _save_parents
geonode | updated = self._save_table(
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 853, in _save_table
geonode | updated = self._do_update(base_qs, using, pk_val, values, update_fields,
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 903, in _do_update
geonode | return filtered._update(values) > 0
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 760, in _update
geonode | return query.get_compiler(self.db).execute_sql(CURSOR)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1471, in execute_sql
geonode | cursor = super().execute_sql(result_type)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1142, in execute_sql
geonode | cursor.execute(sql, params)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
geonode | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
geonode | return executor(sql, params, many, context)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
geonode | return self.cursor.execute(sql, params)
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 89, in __exit__
geonode | raise dj_exc_value.with_traceback(traceback) from exc_value
geonode | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
geonode | return self.cursor.execute(sql, params)
geonode | django.db.utils.InternalError: Cannot find SRID (404000) in spatial_ref_sys
geonode |
geonode | [pid: 268|app: 0|req: 6/46] 172.19.0.2 () {58 vars in 3792 bytes} [Tue Jan 18 09:40:37 2022] POST /layers/Raw_20190819_1653140:geonode:Raw_20190819_1653140/metadata => generated 7884 bytes in 131 msecs (HTTP/1.0 500) 8 headers in 303 bytes (1 switches on core 0)
geonode | [pid: 269|app: 0|req: 6/47] 127.0.0.1 () {24 vars in 254 bytes} [Tue Jan 18 09:41:18 2022] GET / => generated 27463 bytes in 103 msecs (HTTP/1.1 200) 9 headers in 566 bytes (1 switches on core 0)
Steps to Reproduce the Problem
- Open GeoNode with user having upload and layer creation permissions.
- Add new layer using the attached file
Raw_20190819_165314.tif(Raw_20190819_165314.tif.zip; 1.1 MB). - After successfull upload, select the orange button "Edit Metadata".
- Add all required fields: Category, Attribution, Restrictions, Data quality statement.
- Click Update.
Specifications
- GeoNode version:
3.2.1 - Installation method (manual, GeoNode Docker, SPCGeoNode Docker):
GeoNode Docker - Platform:
Linux host 5.13.0-25-generic #26-Ubuntu SMP Fri Jan 7 15:48:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux - Additional details:
- gdalinfo of attached file:
gdalinfo ./Raw_20190819_165314.tif Driver: GTiff/GeoTIFF Files: ./Raw_20190819_165314.tif Size is 1164, 895 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 895.0) Upper Right ( 1164.0, 0.0) Lower Right ( 1164.0, 895.0) Center ( 582.0, 447.5) Band 1 Block=1164x8 Type=Byte, ColorInterp=Red Mask Flags: PER_DATASET ALPHA Band 2 Block=1164x8 Type=Byte, ColorInterp=Green Mask Flags: PER_DATASET ALPHA Band 3 Block=1164x8 Type=Byte, ColorInterp=Blue Mask Flags: PER_DATASET ALPHA Band 4 Block=1164x8 Type=Byte, ColorInterp=Alpha ```
Do you need any additional information?
Is this still relevant for gronode >=4.x?
Did not test this on 4.x. Maybe I will find some time next week to re-test.
@mattiagiupponi on 4.2.2, I could not reproduce the error with regard the message psycopg2.errors.InternalError_: Cannot find SRID (404000) in spatial_ref_sys. Seems, GeoServer uses the code 404000 to indicate an unknown SRID!? Is it something, that GeoNode (importer) should be able to handle?
However, when uploading the provided tif, geoserver complains that CRS is not available:
05 Mar 10:56:16 WARN [gce.geotiff] - Coordinate Reference System is not available
geoserver4geonode | 05 Mar 10:56:16 WARN [gce.geotiff] - Raster to Model Transformation is not available for: /mnt/volumes/statics/uploaded/tmpyzc_5q7t/Raw_20190819_165314.tif
Also, when opening the tif in QGIS, the CRS seems to be unknown.
I suggest to close this one as not reproducable. However, feel free to give feedback how GeoNode handles unknown CRSs.