Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for additional elements #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.formatting.provider": "yapf"
}
140 changes: 140 additions & 0 deletions python_sld.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
Metadata-Version: 1.1
Name: python-sld
Version: 1.0.10
Summary: A simple python library that enables dynamic SLD creation and manipulation.
Home-page: http://github.com/azavea/python-sld/
Author: David Zwarg
Author-email: [email protected]
License: Apache 2.0
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.

from sld import StyledLayerDescriptor
mysld = StyledLayerDescriptor()

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

from sld import StyledLayerDescriptor
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:

fts = ustyle.create_featuretypestyle()
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.

from sld import Filter

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
- MinScaleDenominator
- MaxScaleDenominator
- 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/

Contributors
============

@[ewsterrenburg](https://github.com/ewsterrenburg)


Keywords: ogc sld geo geoserver mapserver osgeo
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: GIS
Requires: lxml
12 changes: 12 additions & 0 deletions python_sld.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
MANIFEST.in
README.markdown
setup.py
python_sld.egg-info/PKG-INFO
python_sld.egg-info/SOURCES.txt
python_sld.egg-info/dependency_links.txt
python_sld.egg-info/top_level.txt
sld/__init__.py
sld/epydoc.config
sld/run_tests.py
sld/test/__init__.py
sld/test/style.sld
1 change: 1 addition & 0 deletions python_sld.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions python_sld.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sld
Loading