After using the Python API mostly for admin purpose in the past, I'm getting a little more into weeds of analytical and data science applications. So I put together a routine that works great for a single location (LL) and leverages the a map in Jupyter Notebooks, Basically something like...
from arcgis import GIS
portalUrl = r' ... my Portal url '
mygis = GIS(portalUrl)
location_coords = [lat, lon]
zoomlevel = some number
myMap = mygis.map(location=location_coords, zoomlevel=zoomlevel)
myMap
This works great and puts out a Web Mercator (EPSG 3857) map that I can add layers to - whatever!
What if I want to move/pan to a different location in the map? Say I have a list of locations to process (which I do). The documentation here suggest that I should be able to do the following to shift the map:
new_location_coords = [new_lat,new_lon]
myMap.center = new_location_coords
This in fact updates the map in the notebook, i.e. pans to the new location centered on the new coordinates.
But when I then call:
myMap.center
I get:
{'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'x': original value, 'y': original value}
where 'original value' the original Web Mercator coordinates from my original Lat/Lon;s. So all the panning does not change the original definition of the map. Am I doing something wrong? Or is this be design or is it a bug? I'd like to be able to use the new center of the map to build some bounding boxes and things like that) but right now, I can't. - Thanks for any feedback.