Select to view content in your preferred language

Accessing layers from webmap

611
2
08-17-2018 08:50 AM
GaryXiao2
Emerging Contributor

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

0 Kudos
2 Replies
MunachisoOgbuchiekwe
Regular Contributor

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
Emerging Contributor

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

0 Kudos