Accessing layers from webmap

475
2
08-17-2018 08:50 AM
GaryXiao2
New Contributor II

accessed layer from webmap, done, but can not view properties , any help?  Thanks!

0 Kudos
2 Replies
MunachisoOgbuchiekwe
New Contributor III

Hello Gary, 

It might be because the major_cities_layers[0] does not have the properties attribute on it. This is the way I get attributes from a layer....

import arcgis
from arcgis.gis import GIS

gis = GIS()
featureLayerItem = gis.content.get('id for your feature layer')
print(featureLayerItem.layers[0].properties.extent)

Which returns this....

{
  "xmin": -178.21759836236583,
  "ymin": 18.921786345087018,
  "xmax": -66.9692710360024,
  "ymax": 71.40623535327114,
  "spatialReference": {
    "wkid": 4269,
    "latestWkid": 4269
  }
}
GaryXiao2
New Contributor II

Thank you for your reply! it works! Thanks much!

0 Kudos