Skip to content

MapContent object move() does not work when attempting to move a layer to a GroupLayer #2278

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

Open
Clubdebambos opened this issue May 4, 2025 · 0 comments
Labels

Comments

@Clubdebambos
Copy link

Describe the bug
MapContent object move() does not work when attempting to move a layer to a GroupLayer

To Reproduce
Steps to reproduce the behavior:

from arcgis.gis import GIS
from arcgis.map import Map

agol = GIS("home")

wm_item = agol.content.get("WM_ITEMID")

webmap = Map(wm_item)

gl = webmap.content.layers[0]

webmap.content.move(
    index=1,
    group=gl
)

webmap.update()

error:

Traceback (most recent call last):
  File "<module1>", line 17, in <module>
  File "C:\Users\glenb\Documents\ArcGIS\Clones\arcgispro-clone\Lib\site-packages\arcgis\map\map_widget.py", line 718, in update
    return self._helper.update(item_properties, thumbnail, metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\glenb\Documents\ArcGIS\Clones\arcgispro-clone\Lib\site-packages\arcgis\map\_utils.py", line 1951, in update
    item_properties["text"] = json.dumps(
                              ^^^^^^^^^^^
  File "C:\Users\glenb\Documents\ArcGIS\Clones\arcgispro-clone\Lib\json\__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "C:\Users\glenb\Documents\ArcGIS\Clones\arcgispro-clone\Lib\json\encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\glenb\Documents\ArcGIS\Clones\arcgispro-clone\Lib\json\encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
ValueError: Circular reference detected

Screenshots
If applicable, add screenshots to help explain your problem.

Expected behavior
That the layer from the main map is moved into the GroupLayer

Platform (please complete the following information):

  • OS: Windows 11 Home
  • Browser Chrome
  • Python API Version 2.4.0

Additional context
Add any other context about the problem here, attachments etc.

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

1 participant