2

I would like to use gsconfig-py3 1.0.8 Python library to create a store that can receive multiple shapefiles, i.e. "Directory of spatial files (shapefiles)" (as it is in geosever), then add multiple shapefiles to it.

I am able to create a store by using the create_featurestore from gsconfig, however it result in a single shapefile store.

from geoserver.catalog import Catalog
cat = Catalog(geoserver_uri + 'rest/', username="username", password="password")
data = r'../file.zip'
store = cat.create_featurestore("test", data, workspace=workspace)
cat.add_data_to_store(store, store.name, data, workspace)

If i try to add another shp it gives the error:

geoserver.catalog.ConflictingDataError: There is already a store named

When I use the create_datastore the store type is not even specified on GeoServer under Data - Stores - Type, while Data Type has an exclamation sign.

store = cat.create_datastore("test", workspace=workspace)
cat.add_data_to_store(store, store.name, data, workspace)

If I try to add a shapefile to it, I get:

geoserver.catalog.FailedRequestError: Error code (500) from GeoServer: Store 'test' already exists in workspace

4
  • 1
    What happens if you use overwrite=True/False in store = cat.create_featurestore("test", data, workspace=workspace, overwrite=True)? – Taras Sep 4 '20 at 7:53
  • @Taras gsconfig-py3 1.0.8 – Paul Nicoara Sep 4 '20 at 8:08
  • @Taras It is working with overwrite=False, when creating the store and with cat.add_data_to_store(store, store.name, data, workspace, overwrite=True) when adding the data. :) – Paul Nicoara Sep 4 '20 at 8:58
  • looking through catalog.py I see nothing that looks like it handles directories of shapefiles, so you may need to extend gsconfig – Ian Turton Sep 4 '20 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.