Hi all.
Using the arcpy.mp module to access and export maps from an ArcGIS Pro project.
I have been able to figure out how to manipulate layouts, mapframes and cameras etc to zoom and scale the display, but I can't figure out yet how to set or change the reference scale of a given map?
I can obviously do this manually within Pro itself, but I can't find a property on the Map object or anywhere that allows me to set this?
Can anyone point me in the right direction?
Cheers,
-Paul
It isn't here is it which is the arcpy model for Pro. You think it would be in the mapping section but it is not.
So you are looking in all the right sections. Even if you can read a property doesn't mean you can set something else that might emulate what you are looking for. There are many read-only properties and fewer read/write ones.
Yeah, I looked through there but couldn't find it anywhere, I was hoping I missed it.
shall we hope that we are both blind in this regard
If it were there, I would expect it in the arcpy.mp.Map class:
It is clearly not there. I don't see it in the .NET SDK either.
ArcGIS Pro 2.0 API Reference Guide - Map Control UPDATE found it here in the SDK doc.
UPDATE It is there now with ArcGIS Pro 2.4 on the Map object properties.
Thanks Curtis - I agree that the 'Map' class is where I would expect it to be and it is not.
Although I also thought possibly it would be on the 'MapFrame' class??
In the arcpy.mapping module, it is present on the 'DataFrame' class as a property that can be set. So I'm picking that it is something that has just not been exposed yet in the mp module. Hopefully they will add it at some point soon. In the scheme of things, should be relatively easy as we know that the property already exists (because we can manipulate it manually within Pro itself).
Be sure and log an idea or post a tech support incident on this. The squeaky wheel gets the grease; over the years I've seen a lot of good ideas from me and my colleagues show up in the software.
Hey! I found it here in the .NET API.
ArcGIS.Desktop.Mapping Namespace > Map Class : SetReferenceScale Method
https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic11892.html :
in ArcMap 10.6.1
(using the new arcpy.mapping module NOT arcpy.mp)
arcpy.mapping.MapDocument("CURRENT").activeDataFrame.referenceScale
returns: u'1:{YourCurrentRefenceScale}'
as a bonus:
arcpy.mapping.MapDocument("CURRENT").activeDataFrame.referenceScale = "1:1000"
will set the Current Reference Scale to 1000 and Refresh the ActiveView.
and:
arcpy.mapping.MapDocument("CURRENT").activeDataFrame.referenceScale = "1:0"
will Clear the Current Reference Scale and Refresh the ActiveView.
Good news, sometime in the last few years it got added in as the referenceScale property on the Map object