I have a PostGIS table with geometry column. In this column I have geometries of several types (polygons, points, lines). I publish this this table on GeoServer.
Now I want to create OpenLayers layer with this data. But how to make a style for this data?
I've already read http://docs.geoserver.org/stable/en/user/styling/sld-tipstricks/mixed-geometries.html and don't want to create gtype
in PostGIS if this possible.
I try to create new style within GeoServer but I think that do something wrong:
<?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">
<!-- a Named Layer is the basic building block of an SLD document -->
<Rule>
<ogc:PropertyIsEqualTo>
<ogc:Function name="geometryType">
<ogc:PropertyName>the_geom</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>Polygon</ogc:Literal>
</ogc:PropertyIsEqualTo>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#0000ff</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</StyledLayerDescriptor>
And get a error:
line 10: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Rule'. 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":NamedLayer, "http://www.opengis.net/sld":UserLayer}' is expected.
line 11: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ogc:PropertyIsEqualTo'. 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.
What am I doing wrong?
UPDATE
I try to show a points and make this rule for this geom type:
<Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:Function name="geometryType">
<ogc:PropertyName>the_geom</ogc:PropertyName>
</ogc:Function>
<ogc:Literal>Point</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#0000ff</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
But not see then on my map. What's wrong?