Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nens/geoserverlib
GeoServer Python client library
https://github.com/nens/geoserverlib
Last synced: 4 days ago
JSON representation
GeoServer Python client library
- Host: GitHub
- URL: https://github.com/nens/geoserverlib
- Owner: nens
- License: gpl-3.0
- Created: 2013-03-28T13:36:29.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-12T08:15:53.000Z (over 11 years ago)
- Last Synced: 2024-04-12T01:12:28.816Z (7 months ago)
- Language: Python
- Size: 227 KB
- Stars: 1
- Watchers: 35
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.rst
Awesome Lists containing this project
README
Geoserverlib
============Introduction
------------Geoserverlib is a `GeoServer`_ Python client for creating, updating, and deleting workspaces, data stores, feature types, layers and styles on geoservers.
Usage
-----* instantiate a client::
from geoserverlib.client import GeoserverClient
# host, port, username, password for the GeoServer you want to connect to
client = GeoserverClient(host, port, username, password)* workspace methods::
workspace = 'my_workspace'
client.create_workspace(workspace)
client.workspace_exists(workspace) # returns True or False
client.delete_workspace(workspace, recurse=True)* shapefile methods::
workspace = 'my_workspace'
datastore = 'my_datastore'
path = absolute_path_to_zipped_shapefileclient.upload_shapefile(workspace, datastore, path)
path = absolute_path_on_geoserver
client.add_shapefile_directory(workspace, datastore, path)* datastore methods::
datastore = 'my_datastore'
# example connection parameters for postgis datastore
connection_parameters = {
'host': 'localhost',
'port': '5432',
'database': '',
'user': '',
'password': '',
'dbtype': 'postgis'
}
client.create_datastore(workspace, datastore, connection_parameters)
client.datastore_exists(workspace, datastore) # returns True or False
client.delete_datastore(workspace, datastore, recurse=True)* feature type and layer methods::
layer = 'my_layer'
sql_query = 'SELECT * FROM ""' # layer specific SQL query
client.create_feature_type(workspace, datastore, layer, sql_query)
client.delete_layer(layer)
client.delete_feature_type(workspace, datastore, layer)* style methods::
style = 'my_style'
# create style from file
style_filename = 'path/to/my_style.sld'
client.create_style(style, style_filename=style_filename)# create style from xml
style_data = 'style_data' # use actual style data here
client.create_style(style, style_data=style_data)# set default style for layer
client.set_default_style(workspace, datastore, layer, style)# delete style
client.delete_style(style)* other methods::
# show the feature type in xml or json
client.show_feature_type(workspace, datastore, layer, output='xml')# recalculate bounding boxes
client.recalculate_bounding_boxes(workspace, datastore, layer).. _GeoServer: http://geoserver.org/display/GEOS/Welcome