1

I am generating a shapefile with a Python script and I want to publish it via GeoServer. The GeoServer is running on localhost 8080.

I learned from this website that the workflow would be:

  1. Add a store
  2. Specify the data source name
  3. Specify the getCapabilities URL
  4. Enter password that is the same as the server
  5. Publish

So far I have come up with this code, but it is somehow a mess and I do not know what exactly I am doing...

from geoserver.catalog import Catalog
from random import randrange
import geoserver.util

nomen='test{}'.format(randrange(10000))
cat = Catalog("http://localhost:8080/geoserver/rest/", "admin", "geoserver")
geosolutions = cat.get_workspace("workspacename")
shapefile_plus_sidecars = geoserver.util.shapefile_and_friends('25832')
ft = cat.create_featurestore(nomen, shapefile_plus_sidecars, workspacename)
that_layer = cat.get_layer(nomen)
print(that_layer.name)

How can I sort this out?

1

You don't want to cascade a remote WFS (that is republish someone else's layers in your own GeoServer). You want to use the GeoServer REST API to add and publish a shapefile.

So you need to look at this tutorial from GeoSolutions

1
  • true that! thx! – Leo Jan 16 '20 at 15:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.