[OpenLayers-Users] WFS + Text (Text_Symbolizer)
Ivan Grcic
igrcic at gmail.com
Fri Nov 27 08:46:47 EST 2009
label: '${NAME}'
On Fri, Nov 27, 2009 at 1:44 PM, stash <steffen.schwarz85 at googlemail.com> wrote:
>
>
>
> Ivan Grcic-2 wrote:
>>
>> It's pretty simple, from the example:
>>
>> label : "name: ${name}, age: ${age}",
>>
>> where ${name} -> feature.attributes.name and ${age} ->
>> feature.attributes.age
>>
>> So labels are attribute values, which you get from your geoserver that
>> gets it from database ;)
>>
>>
>
> Hi,
> thanks for your answer. But can you tell me how to implement the code in my
> app. I only need the name, so my code looks like this at the moment.
>
> var saveStrategy = new OpenLayers.Strategy.Save(options);
> var my_layer = new OpenLayers.Layer.Vector("layer", {
> strategies: [new OpenLayers.Strategy.Fixed({
> preload: false
> }), saveStrategy],
> //filter: my_filter,
> // styleMap: oStyleMap,
> styleMap: new OpenLayers.StyleMap({ 'default': {
> strokeColor: "#00FF00",
> strokeOpacity: 1,
> strokeWidth: 3,
> fillColor: "#FF5500",
> fillOpacity: 0.5,
> pointRadius: 6,
> pointerEvents: "visiblePainted",
> label: feature.attributes.NAME,
> fontColor: "black",
> fontSize: "12px",
> fontFamily: "Courier New, monospace",
> fontWeight: "bold",
> labelAlign: "cm",
> labelXOffset: "25",
> labelYOffset: "0"
> }}),
>
> protocol: new OpenLayers.Protocol.WFS({
> url: "http://localhost:8080/geoserver/wfs",
> featureType: "MY_LAYER",
> featurePrefix: 'topp',
> featureNS: "http://www.openplans.org/topp",
> maxFeatures: 1500,
> defaultFilter: my_filter
> })
> });
>
>
> But when I start my app I get an error --> feature is undefined.
>
> Thanks for your help.
>
> Regards
> stash
> --
> View this message in context: http://n2.nabble.com/WFS-Text-Text-Symbolizer-tp4071914p4075559.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Ivan Grcic
More information about the Users
mailing list