Select to view content in your preferred language

Can you set the reference scale of a Map using arcpy.mp?

4194
9
09-28-2017 02:10 PM
by Anonymous User
Not applicable

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

0 Kudos
9 Replies
DanPatterson_Retired
MVP Emeritus

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.

0 Kudos
by Anonymous User
Not applicable

Yeah, I looked through there but couldn't find it anywhere, I was hoping I missed it.

0 Kudos
DanPatterson_Retired
MVP Emeritus

shall we hope that we are both blind in this regard

0 Kudos
curtvprice
MVP Esteemed Contributor

If it were there, I would expect it in the arcpy.mp.Map class:

Map—ArcPy | ArcGIS Desktop 

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.

by Anonymous User
Not applicable

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).

0 Kudos
curtvprice
MVP Esteemed Contributor

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. 

0 Kudos
curtvprice
MVP Esteemed Contributor

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 : 

0 Kudos
RobbieSymborski
New Contributor

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.

curtvprice
MVP Esteemed Contributor

Good news, sometime in the last few years it got added in as the referenceScale property on the Map object

Map—ArcPy | ArcGIS Desktop 

0 Kudos