Hi Pedro! 

OpenLayers is capable of such replacements since years.

Every ${variable-name} is replaced with the attribute named variable-name of 
the (OpenLayers) feature within the SLD.

So within the following symbolizer

          <sld:PointSymbolizer>
            <sld:Graphic>
              <sld:ExternalGraphic>
                <sld:OnlineResource 
xlink:href="http://test.pt/images/${cod}.png"/>
                <sld:Format>image/png</sld:Format>
              </sld:ExternalGraphic>
              <sld:Size>18</sld:Size>
              <sld:Rotation>${angle}</sld:Rotation>
            </sld:Graphic>
          </sld:PointSymbolizer>
${cod} is replaced with the attribute cod of the feature and ${angle} is 
replaced with the attribute angle.

For a e.g. Feature
{
        "type": "Feature",
        "bbox": [
          13220,
          300880,
          13220,
          300880
        ],
        "geometry": {
          "type": "Point",
          "coordinates": [
            13220,
            300880
          ]
        },
        "properties": {
          "id": 1,
          "cod": "test",
          "angle": 120
        }
      }
cod will replaced with test and angle with 120.

Cheers,
Bernhard

-----Ursprüngliche Nachricht-----
Von: users-boun...@geoext.org [mailto:users-boun...@geoext.org] Im Auftrag von 
users-requ...@geoext.org
Gesendet: Donnerstag, 26. März 2015 12:00
An: users@geoext.org

Date: Wed, 25 Mar 2015 16:44:55 +0000
From: pedrocostaa...@sapo.pt
Subject: [Users] legend
To: users@geoext.org
Message-ID:
        <20150325164455.horde.picifrqqm6bkxgfaf90d...@mail.sapo.pt>
Content-Type: text/plain; charset="utf-8"

Hi guys,

I am using geoext 1.1 with openlayers 2.11.
I have a few point layers (WFS) with associated styles where I pass an image 
adress? to 'externalGraphic' parameter like this 
'http://test.pt/images/point.png'. Works well. My problem is, when I make this 
parameter dynamic to use features attribute value?
like that? "http://test.pt/images/"; + '${cod}" + ".png" the layers symbols 
display the graphic cool but we cannot see them on legend.
You can see an example on attached image. Somenone knows hot to fix that?

thanks in advance
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to