Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

There seem to be three main options:

  1. Manually write the SLD files, based on the SLD cookbook
  2. Create the SLD file in QGIS, then import
  3. Use the add-on GeoExplorer to create custom styles online

Options 2 and 3 are attractive to me, as they avoid writing long SLD files. However, both have failed for me, meaning I still have boring grey polygons being served from my geoserver to a test map.

I also wonder if there other options I've not yet tried, such as styling on the client side, or creating styles with a different GIS whose .sld files work better with geoserver.

In visual terms, I want to go from this: geoserver-polygon-grey

To this:

territories

ASAP (as simply as possible!)

share|improve this question
1  
Do you want to debug options 2 and/or 3 or do you want new ones? We'll need to see the SLD and table schema to do any debugging. –  underdark Nov 11 '12 at 19:29
    
I'd like to find out what the simplest option is, and then proceed from there... Debugging option 3 seems like a big challenge, debugging option 2 should be easier. FYI I attach the polygon data and sld file generated by QGIS. It validated fine in Geoserver, but failed to render the polygons when the style was applied: dl.dropbox.com/u/15008199/voronoi%2Bsld.zip –  RobinLovelace Nov 11 '12 at 20:35
    
How are you getting your polygon data into GeoServer? Is it in a database loaded from a Shapefile or are you simply uploading the Shapefile? In my experience, the most common reason for SLD to fail to render is a difference in field name casing. For example, a Shapefile field name will often be uppercase whereas a PostGIS field name is more commonly lowercase. The SLD file in GeoServer is case-sensitive! –  CHenderson Nov 11 '12 at 21:27
    
Uploading the shapefile. I'll experiment with names, suspect this is the issue: GeoServer logs after attempting to load styled voronoi data includes the following: "2012-11-11 22:19:08,599 ERROR [geoserver.ows] - org.geoserver.platform.ServiceException: The requested Style can not be used with this layer. The style specifies an attribute of names and the layer is: tescmap1:voronoi2". Will experiment changing sld file and report back if it works. –  RobinLovelace Nov 11 '12 at 22:21
add comment

3 Answers 3

up vote 7 down vote accepted

You can use a standalone SLD editor like AtlasStyler SLD Editor. You can style your shape file there, export the SLD and then import it to Geoserver.

enter image description here

share|improve this answer
    
Thanks for the heads up about this - looks like a very neat styling program. I've already tried Udig and QGIS but AtlasStyler seems most compatible with GeoServer. Initial findings: AtlasStyler could not see the attribute "names-5" until I changed it to "fivenames". Perhaps this is why the styling kept failing: dodgy column headings. I will test the newly generated .sld file when I SSH to my EC2 instance tonight and let you know how it goes. –  RobinLovelace Nov 12 '12 at 10:40
    
Glad to be of help :) –  R.K. Nov 12 '12 at 13:02
    
Just tested the AtlasStyler .sld file in GeoServer and I'm afraid to say it still isn't working... Beginning to suspect I'm missing something very obvious here, as the sld file seems to make sense. So if anyone fancies trying to debug this, the example shapefile and 3 sld files (1 generated by QGIS, UDig and AtlasStyler each) can be downloaded here: dl.dropbox.com/u/15008199/test-slds.zip Any obvious errors? Can anyone get this to work in GeoServer? I'm sure there's an easy solution! –  RobinLovelace Nov 12 '12 at 23:44
    
Happens to me sometimes, too. Which specific error are you getting? A workaround is to copy the XML code from the SLD and paste it on Geoserver's SLD editor in the web UI. A bit hackish but it does the job. –  R.K. Nov 13 '12 at 2:05
add comment

I would choose the first option, writing the SLD files.

In the SLD Cookbook there are already many examples or 'recipes'. I guess that you will find an example (recipe) that will match your needs after some customization; thus, you will not have to write your SLD files from scratch.

share|improve this answer
add comment

You can also try out uDig, once you have the style ready copy it from the XML entry of the style dialog, paste it into GeoServer as a new style, and associate the newly created style as the default style for the target layer

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.