Get Acces to Features of a user added Layer with JavaScript

286
1
Jump to solution
01-19-2021 03:14 AM
FlorSch
New Contributor II

Hello Community,

I've got a Problem with getting Acces to the Features of a user added Layer...

What is working:

Adding a Layer with the "Add Data"-Widget.

Getting acces to the Layer with

var layers = this.map.getLayersVisibleAtScale(this.map.getScale());console.log(layers);
var layer = this.map.getLayer(layers[0].id);console.log(layer);

 

Whats not working:

Getting acces to the features of the imported Layer...
I think there should be something like

features = layer.getFeatures();

 

I asked Google for Answers but it doesnt return usefull results...

 

Any help?

 

Best regards!

 

 

0 Kudos
1 Solution

Accepted Solutions
FlorSch
New Contributor II

I found an easy solution:

var layer = this.map.getLayer(this.map.graphicsLayerIds[1])
var feature = layer.graphics[j].geometry;

View solution in original post

0 Kudos
1 Reply
FlorSch
New Contributor II

I found an easy solution:

var layer = this.map.getLayer(this.map.graphicsLayerIds[1])
var feature = layer.graphics[j].geometry;
0 Kudos