GeoNode / geoserver-restconfig

geoserver-restconfig is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.
MIT License
46 stars 29 forks source link

Issue with creating a coverage store #37

Closed iliasmoysidis closed 1 year ago

iliasmoysidis commented 1 year ago

Describe the bug I am trying to create a coverage store in geoserver using the geoserver-restconfig python package. Here is my code:

from geoserver.catalog import Catalog
cat = Catalog(service_url='http://localhost:8080/geoserver/rest',
              username='FAKE_USERNAME',
              password='FAKE_PASSWORD')

# Create working space
cat.create_workspace(name='demo', uri='http://demo')

# Create coverage store
path = 'indicators/coolingdd/rcp_2_6/ensemble/coolingdd_rcp26_multi-model-mean_-_-_20210101-20301230.tiff'
cat.create_coveragestore(name='NAME',
                         workspace='demo',
                         path=path,
                         type='GeoTIFF',
                         create_layer=True,
                         layer_name='TITLE',
                         upload_data=False)

The indicators directory is inside the directory where I am running my python script from. Unfortunately I am getting the following error:

Traceback (most recent call last):
  File "/home/iliamous/PycharmProjects/winbank-esg-risk-gis-platform/scratch_work.py", line 767, in <module>
    cat.create_coveragestore(name='NAME',
  File "/home/iliamous/.local/lib/python3.10/site-packages/geoserver/catalog.py", line 617, in create_coveragestore
    raise FailedRequestError('Failed to create coverage/layer {} for : {}, {}'.format(layer_name, name,
geoserver.catalog.FailedRequestError: Failed to create coverage/layer TITLE for : NAME, 500

I have tried switching the logging profile to developer but it did not work. Here is a screenshot of my global settings:

330892547_883144116052118_3793374878904992418_n

I am using Ubuntu 22.04.2 LTS, python 3.10.6, Google Chrome 110.0.5481.177.

I am also attaching the full log file in case it helps. geoserver.log

A similar version of this question is also posted at: https://stackoverflow.com/questions/75627677/how-to-create-a-coverage-store-using-the-geoserver-restconfig-python-package?noredirect=1#comment133459274_75627677

iliasmoysidis commented 1 year ago

I have found the solution.