MapImageLayer find function

364
1
03-15-2019 11:26 AM
RobertMEIER
New Contributor III

I am trying top use the MapImageLayer find function and it will only return data for the top layer. I have changed the layers parameter to "all", but still just get results for the top layer.

Any help is welcome.

-bert

here's the code I'm using.

from arcgis.gis import GIS
from arcgis.features import FeatureSet, Feature, FeatureLayer, FeatureLayerCollection
from arcgis.mapping import MapImageLayer

theURL = "https://jcgis.jacksongov.org/arcgis/rest/services/ElectionAdministration/ElectedOfficials/MapServer/0"
theURL = theURL[:-2]
mil = MapImageLayer(theURL)

findRes = mil.find("Cleaver","all",return_geometry=True)

print(findRes)

for keyMil, valueMil in findRes.items():
print(keyMil)
##print(valueMil[0])
print(len(valueMil))

0 Kudos
1 Reply
RobertMEIER
New Contributor III

Playing around with this code in Jupyter Notebook, if I use the layer number it works,

theURL = "https://jcgis.jacksongov.org/arcgis/rest/services/ElectionAdministration/ElectedOfficials/MapServer/0"
theURL = theURL[:-2]
mil = MapImageLayer(theURL)

findRes = mil.find("z",1,return_geometry=True)

Oddly, if I use zero for the layer number, it errors, saying missing 'layers' for find operation. But it works if I use the word "top".

The API doc says there are only 3 options for this parameter and that it is an optional parameter, both are not true!

optional string. The layers to perform the identify operation on. There are three ways to specify which layers to identify on:

  • top: Only the top-most layer at the specified location.
  • visible: All visible layers at the specified location.
  • all: All layers at the specified location.
0 Kudos