[Users] legend
Bernhard Kiselka
bernhard.kiselka at prisma-solutions.at
Thu Mar 26 14:01:12 CET 2015
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-bounces at geoext.org [mailto:users-bounces at geoext.org] Im Auftrag von users-request at geoext.org
Gesendet: Donnerstag, 26. März 2015 12:00
An: users at geoext.org
Date: Wed, 25 Mar 2015 16:44:55 +0000
From: pedrocostaarma at sapo.pt
Subject: [Users] legend
To: users at geoext.org
Message-ID:
<20150325164455.Horde.pIcifrQQM6bKxgFAF90d6x1 at 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
More information about the Users
mailing list