Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify on arcpy.layers.MapImageLayer not working because of nested dictionary in geometry #2169

Open
tbock opened this issue Nov 21, 2024 · 1 comment
Labels

Comments

@tbock
Copy link

tbock commented Nov 21, 2024

Describe the bug
Identify on MapImagerLayer return response saying geometry was not provided when it was. You appear to have fallen victim to the well know issue of python requests and nested dictionaries.

To Reproduce
Steps to reproduce the behavior:

l = arcgis.layers.MapImageLayer('https://coast.noaa.gov/arcgis/rest/services/FloodExposureMapper/CFEM_CoastalFloodHazardComposite/MapServer', gis=gis)
f = {"geometry": Point({
        "x" : -13575713.5781, 
        "y" : 4384575.0913000032, 
    "spatialReference": {"wkid": 102100, "latestWkid": 3857}})}

l.identify(geometry=f['geometry'], 
           geometry_type='Point',     
           map_extent={       
               'xmin': f['geometry']['x'],
               'xmax': f['geometry']['x'],
               'ymin': f['geometry']['y'],
               'ymax': f['geometry']['y'],
                'spatialReference': site['geometry']['spatialReference']
            }, 
           image_display='600,550,96',
           tolerance=0,
           return_geometry=False,
           layers='visible')

error:

{'error': {'code': 400,
  'message': "Missing 'geometry' for identify operation.",
  'details': []}}

Screenshots
You can clearly see the mangled data that requests is sending to the server.
image

Expected behavior
Expect it to return the output of the identify operation from the service.

Platform (please complete the following information):

  • OS: Windows and ArcGIS Online
  • Browser n/a and Chrome
  • Python API Version 2.4.0

Additional context
I should not have to wrap the geometry in json.dumps to get it to work.

l.identify(geometry=json.dumps(f['geometry']), 
           geometry_type='Point',     
           map_extent=json.dumps({       
               'xmin': f['geometry']['x'],
               'xmax': f['geometry']['x'],
               'ymin': f['geometry']['y'],
               'ymax': f['geometry']['y'],
                'spatialReference': site['geometry']['spatialReference']
            }), 
           image_display='600,550,96',
           tolerance=0,
           return_geometry=False,
           layers='visible')
@tbock tbock added the bug label Nov 21, 2024
@nanaeaubry
Copy link
Contributor

@tbock Thanks for reporting this, we will take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants