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?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Jan 16, 2020 at 12:50

1 Answer 1

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

answered Jan 16, 2020 at 13:37
1
  • true that! thx! Commented Jan 16, 2020 at 15:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.