compassinformatics / cpsi-mapview

GNU General Public License v3.0
6 stars 14 forks source link

GeoStyler not applying SLD colour #204

Open geographika opened 4 years ago

geographika commented 4 years ago

One of the new demo layers uses a cross symbol based on the SLD generated by https://w08-mapserver.compass.ie/mapserver/?map=/MapServer/apps/mapview-demo/example.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetStyles&LAYERS=ruins

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
   <NamedLayer>
      <Name>ruins</Name>
      <UserStyle>
         <FeatureTypeStyle>
            <Rule>
               <Name>POI: Ruins</Name>
               <PointSymbolizer>
                  <Graphic>
                     <Mark>
                        <WellKnownName>cross</WellKnownName>
                        <Fill>
                           <CssParameter name="fill">#ffd966</CssParameter>
                        </Fill>
                     </Mark>
                     <Size>8</Size>
                  </Graphic>
               </PointSymbolizer>
            </Rule>
         </FeatureTypeStyle>
      </UserStyle>
   </NamedLayer>
</StyledLayerDescriptor>

The legend displays the correct colour (yellow), but the features themselves are displayed in black. See screencast at https://drive.google.com/file/d/1azO1N_ur1wQDRmDRsfEok_TFqw91YgWD/view

Updating #ffd966 to yellow does not change the result.

chrismayer commented 4 years ago

Problem ist at the OpenLayer Parser. When I use the SLD preview everything is correct:

SLD renderer

image

vs.

OpenLayers renderer

image

I'd suggest to make a version upgrade of geostyler-openlayers-parser first and check if this solves the problem. Otherwise this has to be fixed there.

geographika commented 4 years ago

Thanks for looking at this. Currently geostyler-openlayers-parser has to remain on 0.21.0 as v1.0.0 requires OpenLayers 5.0 or higher. Will review again if we move to OL6 in the future.

geographika commented 3 years ago

Same behaviour in the latest version It appears for a cross a default stroke is applied if none is set.

I'm unsure if cross should support just fill (the SLD in the first example was generated by MapServer).

Setting a <stroke> in the XML allows the colour to be set correctly:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>ruins</Name>
    <UserStyle>
      <Name>ruins</Name>
      <Title>ruins</Title>
      <FeatureTypeStyle>
        <Rule>
          <Name>POI: Ruins</Name>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>cross</WellKnownName>
                <Stroke>
                  <CssParameter name="stroke">#ffd966</CssParameter>
                  <CssParameter name="stroke-width">3</CssParameter>
                </Stroke>
              </Mark>
              <Size>8</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
chrismayer commented 3 years ago

I'm unsure if cross should support just fill (the SLD in the first example was generated by MapServer).

Also unsure what the standard says. We might have to check if this is standard compliant. If yes we could adapt the geostyler parser.