Skip to main content

A simple python library that enables dynamic SLD creation and manipulation.

Project description

python-sld

A python library for reading, writing, and manipulating SLD files.

Requirements

The lxml library is required for XML parsing and XML Schema validation. This requirement is listed in requirements.txt, and may be installed using pip with this command:

> sudo pip install -r requirements.txt

Installation

> easy_install python-sld

OR

> pip install python-sld

Usage

Using python-sld to create SLD documents is as easy as instantiating a StyledLayerDescriptor class object.

import sld mysld = StyledLayerDescriptor()

You may also read an existing SLD document in by passing it as a parameter:

import sld mysld = StyledLayerDescriptor(‘mysld.sld’)

Addition of most elements are performed on the parent element, since they are related to parent nodes in order to preserve compliance:

nl = mysld.create_namedlayer() ustyle = nl.create_style()

A couple class objects represent collections of nodes, such as Rules and CssParameters. They are properties of their parent classes (FeatureTypeStyle and Fill/Stroke/Font respectively). They behave as python lists, and you can access any of their items using a python list pattern:

rule1 = fts.Rules[0] print len(fts.Rules) fts.Rules[0] = rule1

Filter objects are pythonic, and when combined with the ‘+’ operator, they become ogc:And filters. When combined with the ‘|’ operator, they become ogc:Or filters.

filter_1 = Filter(rule) # set filter 1 properties

filter_2 = Filter(rule) # set filter 2 properties

rule.Filter = filter_1 + filter_2

You may also construct a filter from an expression when using the create_filter method on the Rule object:

filter = rule.create_filter(‘population’, ‘>’, ‘100’)

Implementation

At the current time, python-sld does ‘’not’’ support the full SLD specification. The current implementation supports the following SLD elements:

  • StyledLayerDescriptor

  • NamedLayer

  • Name (of NamedLayer)

  • UserStyle

  • Title (of UserStyle and Rule)

  • Abstract

  • FeatureTypeStyle

  • Rule

  • ogc:Filter

  • ogc:And

  • ogc:Or

  • ogc:PropertyIsNotEqualTo

  • ogc:PropertyIsLessThan

  • ogc:PropertyIsLessThanOrEqualTo

  • ogc:PropertyIsEqualTo

  • ogc:PropertyIsGreaterThanOrEqualTo

  • ogc:PropertyIsGreaterThan

  • ogc:PropertyIsLike

  • ogc:PropertyName

  • ogc:Literal

  • PointSymbolizer

  • LineSymbolizer

  • PolygonSymbolizer

  • TextSymbolizer

  • Mark

  • Graphic

  • Fill

  • Stroke

  • Font

  • CssParameter

Support

If you have any problems or questions, please visit the python-sld project on github: https://github.com/azavea/python-sld/

Project details


Download files

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

Source Distributions

python-sld-1.0.10.tar.gz (19.1 kB view details)

Uploaded Source

python-sld-1.0.9.tar.gz (17.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

python_sld-1.0.10-py3.2.egg (39.6 kB view details)

Uploaded Egg

python_sld-1.0.10-py2.7.egg (39.0 kB view details)

Uploaded Egg

python_sld-1.0.9-py3.2.egg (38.6 kB view details)

Uploaded Egg

python_sld-1.0.9-py2.7.egg (38.0 kB view details)

Uploaded Egg

File details

Details for the file python-sld-1.0.10.tar.gz.

File metadata

  • Download URL: python-sld-1.0.10.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-sld-1.0.10.tar.gz
Algorithm Hash digest
SHA256 7bb8a3ad60f00838eb2c3b4fbdf0ac54d1cfccf5b13f57a368066dd5fe227567
MD5 f3c955b72781c5a7f46a776ebf7512d2
BLAKE2b-256 ab81aa9090666ca5805f2e65afac7869b54133805b083f994d7b777b02eaab77

See more details on using hashes here.

File details

Details for the file python-sld-1.0.9.tar.gz.

File metadata

  • Download URL: python-sld-1.0.9.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-sld-1.0.9.tar.gz
Algorithm Hash digest
SHA256 bc18754ae8e56f9d32bcdf441b0e8a926079f0590281ce192595dbcb54e5d85b
MD5 c6e37dcc07ef68ca485dad2bef626085
BLAKE2b-256 6229981aa8f1afb5ec45b3e918193384fb789918de1a757ee759d309fd4496e1

See more details on using hashes here.

File details

Details for the file python_sld-1.0.10-py3.2.egg.

File metadata

File hashes

Hashes for python_sld-1.0.10-py3.2.egg
Algorithm Hash digest
SHA256 6af4a4cf4488344c8883ee5611170a9b5379ace66d875a70a5477a46fad4c1d1
MD5 e62995be034aedc6a75138a4e9ef37a4
BLAKE2b-256 d4e6ccbf523269250bd118bd0ef262147f4a425d058c84cbb1a5432e2425c40e

See more details on using hashes here.

File details

Details for the file python_sld-1.0.10-py2.7.egg.

File metadata

File hashes

Hashes for python_sld-1.0.10-py2.7.egg
Algorithm Hash digest
SHA256 8226dd162224019880ad03fc25d5c2caeda8dde4681999c72e2a60fdfdfdbe47
MD5 2176aa7855633d894fb675b1e4624c22
BLAKE2b-256 a52c9bd89cf844395a104b1b4d9df21fdbcf12c3cfa2c39062e037ff19d904ad

See more details on using hashes here.

File details

Details for the file python_sld-1.0.9-py3.2.egg.

File metadata

  • Download URL: python_sld-1.0.9-py3.2.egg
  • Upload date:
  • Size: 38.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python_sld-1.0.9-py3.2.egg
Algorithm Hash digest
SHA256 67ee093aeee30494fabfeec66b43a74d5e01e0ab55e1a5898eeebb131bd62d91
MD5 3e8415a377ea9e88bdc67190cdd2aa3b
BLAKE2b-256 c190ed0761b041307f2de3110242051c107ef0dc60d19a2a234d646b3677444d

See more details on using hashes here.

File details

Details for the file python_sld-1.0.9-py2.7.egg.

File metadata

  • Download URL: python_sld-1.0.9-py2.7.egg
  • Upload date:
  • Size: 38.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python_sld-1.0.9-py2.7.egg
Algorithm Hash digest
SHA256 f623c034d1d8d484f41b8f57dabd5197e1148959c43587e4c95a8b1d1415e8ac
MD5 70ae574c1706f888a9afaf714cb641b8
BLAKE2b-256 35809a549bad50a8501cdb6cf66679056eca673abab061e7b3eafbb4e4b53504

See more details on using hashes here.

Supported by

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