GeoNode / geonode-project

A django template project for creating custom GeoNode projects.
http://geonode.org
79 stars 173 forks source link

The uploaded dataset is not working in Geonode 4.1.x. #453

Closed techworldthink closed 1 year ago

techworldthink commented 1 year ago

The uploaded dataset is not working in Geonode 4.1.x. It shows like this. Screenshot from 2023-07-07 11-13-44

audetrobergem commented 1 year ago

Hi @techworldthink,

I had the same problem on my GeoNode Project instance and I think I've found a solution.

First, I had to update the geonode-importer library (see https://github.com/GeoNode/geonode/issues/11203).

I noticed that the published layers were indeed created in the database but not in GeoServer. In the file import/publisher.py, the settings are imported from GeoNode . As I'm using project mode, these are the default GeoNode settings, not mine. If I change this line to from django.conf import settings, I get the settings that are saved in my project's settings.py file.

I then encountered another problem with publishing the layer in GeoServer. I don't use Docker or environment variables, so perhaps you won't encounter this problem. The datastore name is loaded here. In my case, as I don't use environment variables, the default value was used (geonode_data). I had to add the parameter GEONODE_GEODATABASE={{project_name}}_data to my settings.py file and replace the line with geodatabase = settings.GEONODE_GEODATABASE.

The upload worked after those changes. I tested it with different shapefiles and a GeoPackage with 4 layers and everything was published without errors.

I hope this helps!

techworldthink commented 1 year ago

@audetrobergem It works after installing geonode importer and gdal-bin by following this link (https://github.com/GeoNode/geonode/issues/11203) mentioned by you.

Thank you for your reply

Hi @techworldthink,

I had the same problem on my GeoNode Project instance and I think I've found a solution.

First, I had to update the geonode-importer library (see GeoNode/geonode#11203).

I noticed that the published layers were indeed created in the database but not in GeoServer. In the file import/publisher.py, the settings are imported from GeoNode . As I'm using project mode, these are the default GeoNode settings, not mine. If I change this line to from django.conf import settings, I get the settings that are saved in my project's settings.py file.

I then encountered another problem with publishing the layer in GeoServer. I don't use Docker or environment variables, so perhaps you won't encounter this problem. The datastore name is loaded here. In my case, as I don't use environment variables, the default value was used (geonode_data). I had to add the parameter GEONODE_GEODATABASE={{project_name}}_data to my settings.py file and replace the line with geodatabase = settings.GEONODE_GEODATABASE.

The upload worked after those changes. I tested it with different shapefiles and a GeoPackage with 4 layers and everything was published without errors.

I hope this helps!

It works after installing geonode importer and gdal-bin by following this link (https://github.com/GeoNode/geonode/issues/11203).

Thank you for your reply