I've a layer who contain many parameters like number. I try to "navigate" in this layer for make a specific action.

The schematic structure of my layer look like :

object : [a] - item (1) - [o] - name (Name layer) - [o] - source (14) - [o] - number (14)

for take the name of my layer I'wrote (return "Name layer") :


but if I want to make an action on the layer "Name layer" and the number "14", how can I do that ?

I tried : map.getLayers().item(1).get('name').item(14).get('number');

But it's don't that.


I find the solution. You can make a loop in your object like that :

for (var a = 0; a < length; a++) {

    console.log (layers.a[i].o['source'].o[a].o['number']);

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.