Skip to main content

Package for GeoServer rest API

Project description

Documentation

Installation

pip install wheel
pip install pipwin
pipwin install gdal

pip install geoserver-rest

How to use

This library is used for creating workspace, coveragestore, featurestore, styles. Some of the examples are shown below.

Initialize the library

This step is used to initialize the library. It takes parameters as geoserver url, username, password.

from geo.Geoserver import Geoserver
geo = Geoserver('http://localhost:8080/geoserver', username='admin', password='geoserver')
Create workspace
geo.create_workspace('demo')
Create coveragestore

It is helpful for publishing the raster data to the geoserver. Here if you forgot to pass the lyr_name parameter, it will take the raster file name as the layer name.

geo.create_coveragestore(lyr_name='layer' path=r'path\to\raster\file.tif', workspace='demo')
Create featurestore and publish layer

It is use for connecting the PostGIS with geoserver and publish this as a layer. It is only use for vector data.

geo.create_featurestore(store_name='geo_data', workspace='demo', db='postgres', host='localhost', pg_user='postgres', pg_password='admin')
geo.publish_featurestore(workspace='demo', store_name='geo_data', pg_table='geodata_table_name')
Upload style and publish it

It is use for uploading SLD files and publish style

geo.upload_style(path=r'path\to\sld\file.sld', workspace='demo')
geo.publish_style(layer_name='geoserver_layer_name', style_name='sld_file_name', workspace='demo')
Create Coverage Style based on the raster (Dynamic) and apply style

It is use to create the style file for raster data. You can get the color_ramp name from matplotlib colormaps.

#Style name will be the same as the raster_file_name
geo.create_coveragestyle(raster_path=r'path\to\raster\file.tiff', style_name='style_1', workspace='demo', color_ramp='RdYiGn')
geo.publish_style(layer_name='geoserver_layer_name', style_name='raster_file_name', workspace='demo')
Create featur style

It is use for creating the style for point, line, polygon dynamically. Currently it supports three different type of feature styles,

  1. Outline featurestyle: For only outline color
  2. Catagorized featurestyle: For creating catagorized dataset
  3. Classified featurestyle: Classify the input data and style it

Note:

  • The geom_type must be point or line or polygon
  • The color_ramp name can be get from matplotlib colormaps.
geo.create_outline_featurestyle(style_name='new_style' color="#3579b1" geom_type='polygon', workspace='demo')
geo.create_catagorized_featurestyle(column_name='name_of_column', column_distinct_values=[1,2,3,4,5,6,7], workspace='demo', color_ramp='tab20', geom_type='polygon', outline_color='#000000')

Project details


Release history Release notifications | RSS feed

This version

0.3.0

Download files

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

Source Distribution

geoserver-rest-0.3.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

geoserver_rest-0.3.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file geoserver-rest-0.3.0.tar.gz.

File metadata

  • Download URL: geoserver-rest-0.3.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for geoserver-rest-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4237f13d90533f6c7f0c87256b3151a0a5ed14fc283f39e1d8e76fa09ac294b3
MD5 4f7d22aae1213f6f228b2a252a23c771
BLAKE2b-256 46f2539fe0c588775e8cbb8d66b2f7aa33f558937f0fd79d31a0ccf0cd521863

See more details on using hashes here.

File details

Details for the file geoserver_rest-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: geoserver_rest-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for geoserver_rest-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52ad6fb269ef26133ce7e9ff4aad20ce8570de73fa90b6159e8abc7250cdcf2a
MD5 44cc37d7956f7c8d8393afe50872a3d8
BLAKE2b-256 a1a56f753d1d4762014610592122477c71e3ab9e2355579d501a068574f54b3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page