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.

I'm trying to build a Geoserver (V2.0.2) style file for OSM data using https://github.com/FlorentDotMe/OSM-Styles-for-GeoServer as a starting point but they produce a number of validation errors

Can some one suggest where I'm going wrong or where I can get a valid style file for OSM data (Points, Lines and Polygons)

This is what i've done to date. According to this blog you can ignore these http://guanxiaoyu.blogspot.co.uk/2010/06/florentdotmes-osm-sld-for-geoserver.html

and previewing the separate layers works however grouping the layers together Lines on top of polygons & then attempt to preview the group doesn't work the file save to dialogue box is shown indicating an error I'm assuming is related to the validation errors

following the instructions in this comment http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/#comment-76354 I've attempted to fix the style_osm_line but I'm still getting loads of errors

so I've created a smaller manageable sub file to work out how it works, I'm aware it is very incomplete. I get the following errors.

Thanx for you help Holly

Errors

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Filter'. One of '{"http://www.opengis.net/sld":Name, "http://www.opengis.net/sld":Title, "http://www.opengis.net/sld":Abstract, "http://www.opengis.net/sld":LegendGraphic, "http://www.opengis.net/ogc":Filter, "http://www.opengis.net/sld":ElseFilter, "http://www.opengis.net/sld":MinScaleDenominator, "http://www.opengis.net/sld":MaxScaleDenominator, "http://www.opengis.net/sld":Symbolizer}' is expected.
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Filter'. One of '{"http://www.opengis.net/sld":Name, "http://www.opengis.net/sld":Title, "http://www.opengis.net/sld":Abstract, "http://www.opengis.net/sld":LegendGraphic, "http://www.opengis.net/ogc":Filter, "http://www.opengis.net/sld":ElseFilter, "http://www.opengis.net/sld":MinScaleDenominator, "http://www.opengis.net/sld":MaxScaleDenominator, "http://www.opengis.net/sld":Symbolizer}' is expected.
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Filter'. One of '{"http://www.opengis.net/sld":Name, "http://www.opengis.net/sld":Title, "http://www.opengis.net/sld":Abstract, "http://www.opengis.net/sld":LegendGraphic, "http://www.opengis.net/ogc":Filter, "http://www.opengis.net/sld":ElseFilter, "http://www.opengis.net/sld":MinScaleDenominator, "http://www.opengis.net/sld":MaxScaleDenominator, "http://www.opengis.net/sld":Symbolizer}' is expected.
org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'ogc:Or' is not complete. One of '{"http://www.opengis.net/ogc":comparisonOps, "http://www.opengis.net/ogc":spatialOps, "http://www.opengis.net/ogc":logicOps}' is expected.

SLD File

<?xml version="1.0" encoding="ISO-8859-1"?> <StyledLayerDescriptor version="1.0.0" 
    xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
    xmlns="http://www.opengis.net/sld" 
    xmlns:ogc="http://www.opengis.net/ogc" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NamedLayer>
     <Name>style_osm_line</Name>
    <UserStyle>
    <Title>'Line'</Title>
    <!--TAG-->
    <FeatureTypeStyle>
    <Rule>
    <Filter>
      <ogc:Or>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>highway</ogc:PropertyName>
          <ogc:Literal>footway</ogc:Literal>
        </ogc:PropertyIsEqualTo>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>highway</ogc:PropertyName>
          <ogc:Literal>pedestrian</ogc:Literal>
        </ogc:PropertyIsEqualTo>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>highway</ogc:PropertyName>
          <ogc:Literal>path</ogc:Literal>
        </ogc:PropertyIsEqualTo>
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>highway</ogc:PropertyName>
          <ogc:Literal>steps</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Or>
    </Filter>

    <MinScaleDenominator>1000</MinScaleDenominator>
    <MaxScaleDenominator>12500</MaxScaleDenominator>
    <LineSymbolizer>
      <Stroke>
        <CssParameter name="stroke">#A20808</CssParameter>
        <CssParameter name="stroke-width">2</CssParameter>
        <CssParameter name="stroke-dasharray">1 3</CssParameter>
        <CssParameter name="stroke-linejoin">round</CssParameter>
        <CssParameter name="stroke-linecap">round</CssParameter>
        <CssParameter name="stroke-opacity">0.5</CssParameter>
        </Stroke>
    </LineSymbolizer>
    </Rule>
    </FeatureTypeStyle>
   <FeatureTypeStyle>
    <Rule>
    <Filter>
    <ogc:Or>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>highway</ogc:PropertyName>
        <ogc:Literal>unclassified</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>highway</ogc:PropertyName>
        <ogc:Literal>road</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>highway</ogc:PropertyName>
        <ogc:Literal>residential</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>highway</ogc:PropertyName>
        <ogc:Literal>unsurfaced</ogc:Literal>
      </ogc:PropertyIsEqualTo>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>highway</ogc:PropertyName>
        <ogc:Literal>living_street</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Or>
    </Filter>
    <MinScaleDenominator>1000</MinScaleDenominator>
    <MaxScaleDenominator>12500</MaxScaleDenominator>
    <TextSymbolizer>
      <Label>
        <ogc:PropertyName>name</ogc:PropertyName>
      </Label>
      <Font>
        <CssParameter name="font-family">Lucida Sans</CssParameter>
        <CssParameter name="font-size">10</CssParameter>
        <CssParameter name="font-style">normal</CssParameter>
        <CssParameter name="font-weight">normal</CssParameter>
      </Font>
      <LabelPlacement>
      <LinePlacement />
      </LabelPlacement>
      <Halo>
        <Radius>1</Radius>
        <Fill>
          <CssParameter name="fill">#ffffff</CssParameter>
        </Fill>
      </Halo>
      <Fill>
        <CssParameter name="fill">#000000</CssParameter>
        <CssParameter name="fill-opacity">1.0</CssParameter>
      </Fill>
      <VendorOption name="followLine">true</VendorOption>
      <VendorOption name="group">yes</VendorOption>
      <VendorOption name="spaceAround">0</VendorOption>
      <VendorOption name="maxDisplacement">300</VendorOption>
      <VendorOption name="repeat">750</VendorOption>
    </TextSymbolizer>
    </Rule>
    </FeatureTypeStyle>
    <FeatureTypeStyle>
      <Rule>
      <Filter>
      <ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>highway</ogc:PropertyName><ogc:Literal>tertiary</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or>
      </Filter>
      <MinScaleDenominator>1000</MinScaleDenominator>
      <MaxScaleDenominator>12500</MaxScaleDenominator>
      <LineSymbolizer>
        <Stroke>
        <CssParameter name="stroke">#bbbbba</CssParameter>
        <CssParameter name="stroke-width">10</CssParameter>
        <CssParameter name="stroke-linejoin">round</CssParameter>
        <CssParameter name="stroke-linecap">round</CssParameter>
        </Stroke>
      </LineSymbolizer>
      </Rule>
    </FeatureTypeStyle>

    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
share|improve this question
    
SLD file seems out of date - 2 years old - compared to this osm road SLD - blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap - sld link blog.geoserver.org/wp-content/uploads/osm_roadssld.zip –  Mapperz Jul 6 '12 at 16:56
    
I'm using that sld but despite what the map on the blog implies it only styles the road not polygons or other lines like footpaths –  Holly Jul 6 '12 at 17:53
add comment

2 Answers

up vote 3 down vote accepted

The error messages are quite clear:

content was found starting with element 'Filter'. One of '{"http://www.opengis.net/sld":Name, "http://www.opengis.net/sld":Title, "http://www.opengis.net/sld":Abstract, "http://www.opengis.net/sld":LegendGraphic, "http://www.opengis.net/ogc":Filter, "http://www.opengis.net/sld":ElseFilter, "http://www.opengis.net/sld":MinScaleDenominator, "http://www.opengis.net/sld":MaxScaleDenominator, "http://www.opengis.net/sld":Symbolizer}' is expected

If you look through the list of expected elements you will see "http://www.opengis.net/ogc":Filter where as you have sld:Filter (though the sld: is implied) so change Filter to ogc:Filter to fix.

For the remaining error:

org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'ogc:Or' is not complete. One of '{"http://www.opengis.net/ogc":comparisonOps, "http://www.opengis.net/ogc":spatialOps, "http://www.opengis.net/ogc":logicOps}' is expected.

This implies one of the Or filters is broken, I can't see exactly what is wrong in the box above but it's probably a typo or a capitalisation problem.

share|improve this answer
    
Thanx for pointing out the filter error i hadn't made the connection, the fix suggested worked. In the example above the <ogc:Or> error will be due to a cut down version just to post something. However in the real sld i'm getting loads of <ogc:Or> & <ogc:And> errors. Any idea where i can find an example / tutorial of how to use these filter within the contex above? Thnx Holy –  Holly Jul 9 '12 at 10:46
add comment

You may be assuming to much (when you say the error must be due to the validation errors). Please look in the geoserver logs and provide the full stack trace that pops up when you get the error, or else, turn on "verbose exceptions" in the "global" section and then attach the full error text you get (it's going to be very long.

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.