add an attributes of all featuresVector object in WFS layer according other attribute in the object ?

28 views
Skip to first unread message

fbm

unread,
May 22, 2012, 9:33:04 AM5/22/12
to openscales-dev
Hi all !

I would like to add custom attributes on all features object in an
WFS layer, based on an arraycollection on the fly.
What's the best way to do this in openscale 2.0 ?
In short, how to link custom data with vectorFeature (booth have seam
ID value, my array and each vectorFeature in the layer) for style this
object about my data ?

Than'ks for your help!

fbm

WillPetty

unread,
May 22, 2012, 1:52:09 PM5/22/12
to opensca...@googlegroups.com
I'm not quite sure what your asking, but you should be able to just add a attribute.
for example if you want to add a attribute called "test" and you want the value of test to be "ahh!" then you just do something like this:

layer.features[i].attributes.test = "ahh!";

it sounds like you may want to sort the features by a attribute (like that ID value) first, and then just loop through and add the attributes.

I haven't tried this yet but you should be able to sort features( depending on what  WFS service you are using) by adding something like this :

&sortBy=PERSONS%20D

to the layer in the WFS call.  this is saying sort by the attribute PERSONS (%20) just means space and the D means in descending order.

read more about sorting here http://geo-solutions.blogspot.com/2011/12/wfs-for-masses-adding-support-for.html

hope that helps,
-will
Message has been deleted

fbm

unread,
May 23, 2012, 4:32:34 AM5/23/12
to openscales-dev


Hi Will !
Thank's for your reply.

Yes, thhat's what i would like to do. For one side i have some array
with datas (ex : 2 colomns in this array -> "ID" and "SOMTHING"), and
one the other side, WFS layer with objects with "ID" attributes. So
my request is to inject "SOMETHING" values in layer WFS objects,
relatively to "ID".
I will try to loop all the object's layers and use the command you
mentioned ( ex : layers.featurs[i].attributes.SOMTHING =
myArray.SOMTHING[where layers.featurs[i].attributes.ID like
myArray.ID]).
I'm affraid it's verry slow but i'don't see any other solution...

thank's

Reply all
Reply to author
Forward
0 new messages