SLD Generation

20 views
Skip to first unread message

Dr. Micah Altman

unread,
Nov 30, 2011, 11:08:51 AM11/30/11
to districtb...@googlegroups.com
To follow up on David's question. There are a few OSS packages that have SLD functionality that might be adapted for general SLD generation in districtbuilder, or to make a more general SLD library.

1. AtlasStyler http://en.geopublishing.org/AtlasStyler  Java. Claims to be LPGL, though  I haven't yet found the source tree. Available cross platform, with ubuntu support. Designed as a stand alone desktop app, but appears to contain all the functionality for general SLD generation, including the data analytics --  quantile/class-break color/ramp, etc. 


Not sure if its scriptable, but  likely classes could be used directly.


2. Quantum GIS

Quantum is GPL'ed. It uses its own symbology, but can do the all of the necessary analytics and symbolization, etc. And has python plugins to export these layers to SLD:

http://pyqgis.org/manager/python_plugin/list

In theory, quantum is scriptable. Code could also be extracted and repurposed. 

Bigger development and user base than Atlas, but more complex to adapt the code.

3. GeoServer


SLDValidator in the geoserver dist geoserver org.vfny.geoserver.util might be useful for robustness... reused in Udig


4. 

Udig:

http://udig.refractions.net/files/docs/api-udig/udig-1.2-M6/net.refractions.udig.style.sld/allclasses-noframe.html


LGPL'ed Java classes for SLD editing. Does not appear useful for generating quantiles/data analytics, but might be reused to generate syntactically correct SLD given the correct impute values. Unsure about scriptability



best,


Micah

 

David Zwarg

unread,
Dec 1, 2011, 9:53:30 AM12/1/11
to districtb...@googlegroups.com
Hello Micah,

Thanks for compiling this list. I will clarify what I was looking for (for the list's sake), so it will put these packages in context a little more.

I am looking for a python library for generating SLDs. In a perfect world, I would use this in our setup and datatools to generate a default SLD based on the distribution of datasets.  I was envisioning a tool that could generate a simple, 5 quantile class break SLD for a given feature type (or layer, in Geoserver).

As such, I've been looking for python libraries, and the Quantum GIS packages come close. Unfortunately, there seem to be some dependencies on Qt (which makes sense on the Desktop, but not so much in django).

I did consider using geoscript, but it's in a strange realm between java and python, and runs in a jython interpreter. This is nice from a syntax point of view, but it doesn't make it compatible with any of our django code.

Since I couldn't find anything suitable, I've started building out a library I'm calling django-sld at the moment: https://github.com/dzwarg/django-sld. The reason it's django-ish is that I would love to use this library and perform the following operation(-ish):

queryset = Geounit.objects.all()
sld = StyledLayerDescriptor()
sld.create_quantiles(5, queryset)
sld.save()

And as such, I can use this in our setup scripts and the subject upload workflow.

Thanks,
Zwarg
--
David Zwarg, Software Developer

Azavea  |  One Cambridge Center, 6th Floor, Cambridge, MA 02142-1601
dzw...@azavea.com  | T 617.649.2227  | F 215.925.2663
Web azavea.com  |  Blog azavea.com/blogs

Dr. Micah Altman

unread,
Dec 1, 2011, 10:27:38 AM12/1/11
to districtb...@googlegroups.com
Sure. Makes sense that a pure python solution would be easiest to integrate..

And I only took a quick look at the code for thise. The QGIS  savesld
package looked close. From the little I saw the Qt dependencies were
mostly for dialog etc, which could just be dropped, and for things
like color definitions which could be refactored out. Seemed like it
might be easier to take a relatively complete package that appears to
do all the quantile/sld generation/ refactor out the  non QGIS
dependencies and repackage, then to roll a new SLD lib from scratch...
but   seems to a practical tradeoff decision between effort spent on
integration vs. effort spent on (re)implementing the code SLD
generation functions. In the end its completely your call.. And did
the OpenGeo folks have any advice?


best,

Micah


--
________________________________________________________________________
Micah Altman, Ph.D. <http://redistricting.info>           Twitter: @drmaltman
Senior Research Scientist, Institute for Quantitative Social Science, Harvard U.
Director of Archiving and Acquisitions, IQSS;
"Entia non sunt multiplicanda sine necessitate" - Dr. Invincibilis
(Corollary, "Ad indicia spectate.")

Reply all
Reply to author
Forward
0 new messages