I am using arcgispro 2.2.4, and have a python script which needs the actual extents of the current map view. I use this code...
#get the map extents from the current map... aprx = arcpy.mp.ArcGISProject("current") aprxMap = aprx.listMaps("Map") mapView = aprx.listMaps() mapExtents=mapView.defaultCamera.getExtent() TL = mapExtents.upperLeft BR = mapExtents.lowerRight
which suggests the map upper latitude limit is -13.978...
however, if I roll my mouse to the top left of the map view, it is more like -13.933
The extents do change when I pan the map, but they are always a significant subset of the actual viewable area, which is really strange.
Can some one please let me know how I can get the actual extents of the map view?
I do have a spatial reference set for the map. It is GCS WGS 1984
Having debugged this further, the camera extents DO-NOT change when the map is panned/zoomed and the python script rerun. The numbers remain the same.
I guess I am doing something wrong, just not sure what!
any more thoughts how I can use python to get hold of the extents of my map view? I dont see any way forward right now, as the camera simply does not provide the correct extents to the map view
From what I can see, camera extents only work correctly with map frames within layouts.
This is with a project with one map, one layout and one map frame in the layout..
p = arcpy.mp.ArcGISProject("current")
l = p.listLayouts()
f = l.listElements()
<Point (436809.68803366175, 433075.2979928817, #, #)>
.. navigate in the layout's map frame..
<Point (437874.1306022081, 432917.17427798914, #, #)>