all features of a layer

2243
2
Jump to solution
04-17-2016 05:52 AM
behsoh
by
New Contributor II


Hi,

is there any way too get geometries of all features within a feaureLayer.

i already do it for selected features by using myLayer.getSelectedFeatures()

how can I get all of them?

0 Kudos
1 Solution

Accepted Solutions
behsoh
by
New Contributor II

It just return the layer. not features in it.

I finally find a solution.

with using query, we can select all features within a layer

var allQuery = new Query();
allQuery.where = "OBJECTID = OBJECTID";
allQuery.returnGeometry = true;
allQuery.outFields = ["*"];

selecteds.queryFeatures(allQuery, function (featureSet){

...

})

View solution in original post

2 Replies
AdrianWelsh
MVP Notable Contributor

Hi Beh,

Could you try the getLayer() method?

Graphic | API Reference | ArcGIS API for JavaScript

behsoh
by
New Contributor II

It just return the layer. not features in it.

I finally find a solution.

with using query, we can select all features within a layer

var allQuery = new Query();
allQuery.where = "OBJECTID = OBJECTID";
allQuery.returnGeometry = true;
allQuery.outFields = ["*"];

selecteds.queryFeatures(allQuery, function (featureSet){

...

})