Skip to main content
Help us improve Python packaging – donate today!

GeoServer REST Configuration

Project Description

gsconfig.py

gsconfig.py is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.

Installing

For users: pip install gsconfig

For developers: git clone git://github.com/dwins/gsconfig.py.git && cd gsconfig.py && python setup.py develop (virtualenv to taste.)

Getting Help

There is a brief manual at http://dwins.github.com/gsconfig.py/ . If you have questions, please ask them on the GeoServer Users mailing list: http://geoserver.org/display/GEOS/Mailing+Lists . Please use the Github project at http://github.com/dwins/gsconfig.py for any bug reports (and pull requests are welcome, but please include tests where possible.)

Sample Layer Creation Code

from geoserver.catalog import Catalog
cat = Catalog("http://localhost:8080/geoserver/")
topp = self.cat.get_workspace("topp")
shapefile_plus_sidecars = shapefile_and_friends("states")
# shapefile_and_friends should look on the filesystem to find a shapefile
# and related files based on the base path passed in
#
# shapefile_plus_sidecars == {
#    'shp': 'states.shp',
#    'shx': 'states.shx',
#    'prj': 'states.prj',
#    'dbf': 'states.dbf'
# }

# 'data' is required (there may be a 'schema' alternative later, for creating empty featuretypes)
# 'workspace' is optional (GeoServer's default workspace is used by... default)
# 'name' is required
ft = self.cat.create_featuretype(name, workspace=topp, data=shapefile_plus_sidecars)

Running Tests

Since the entire purpose of this module is to interact with GeoServer, the test suite is mostly composed of integration tests. These tests necessarily rely on a running copy of GeoServer, and expect that this GeoServer instance will be using the default data directory that is included with GeoServer. This data is also included in the GeoServer source repository as /data/release/. In addition, it is expected that there will be a postgres database available at postgres:postgres@localhost:5432/db. You can test connecting to this database with the psql command line client by running $ psql -d db -Upostgres -h localhost -p 5432 (you will be prompted interactively for the password.)

Here are the commands that I use to reset before running the gsconfig tests:

$ cd ~/geoserver/src/web/app/
$ PGUSER=postgres dropdb db
$ PGUSER=postgres createdb db -T template_postgis
$ git clean -dxff -- ../../../data/release/
$ git checkout -f
$ MAVEN_OPTS="-XX:PermSize=128M -Xmx1024M" \
GEOSERVER_DATA_DIR=../../../data/release \
mvn jetty:run

At this point, GeoServer will be running foregrounded, but it will take a few seconds to actually begin listening for http requests. You can stop it with CTRL-C (but don’t do that until you’ve run the tests!) You can run the gsconfig.py tests with the following command:

$ python setup.py test

Release history Release notifications

History Node

1.0.8

History Node

1.0.7

History Node

1.0.6

History Node

1.0.4

History Node

1.0.3

History Node

1.0.0

History Node

0.7.0

History Node

0.6.13

History Node

0.6.12

History Node

0.6.11

History Node

0.6.10

History Node

0.6.9

History Node

0.6.8

History Node

0.6.7

History Node

0.6.6

History Node

0.6.5

History Node

0.6.4

History Node

0.6.3

History Node

0.6.2

This version
History Node

0.6.1

History Node

0.6.0

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gsconfig-0.6.1.tar.gz (14.0 kB) Copy SHA256 hash SHA256 Source None Sep 5, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page