Not sure where to start...

867
6
Jump to solution
09-19-2021 02:50 AM
PaulCleverleyArup
New Contributor II

Hi - new to this community - I'm a programmer not a GIS expert. I'm trying to find which classes/functions I can use from a Python program, external to ArcPro, using arcpy in order to change field values in a .PAGX file.  Can anyone help me find out if this is even feasible (or even sensible)?

Thanks! 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
IhabHassan
Esri Contributor

Hi @PaulCleverleyArup 
Yes, you can use Python IDEs like VSCode or Pycharm to write python code and use arcpy or any of the packages in the default Pro python environment.
When you say "using arcpy in order to change field values", I assume here that you want to edit features in your ArcGIS Pro project. If that is correct, then I would suggest going through this doco page and sample code provided:

https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/updatecursor-class.htm

Regards

Ihab

Regards
Ihab

View solution in original post

6 Replies
DavidPike
MVP Frequent Contributor

Are you saying without a Pro license/installation?

0 Kudos
PaulCleverleyArup
New Contributor II
Hi David,

Thanks for your response. Full corporate licensing is in place so that shouldn't be an issue, I hope :-)!

0 Kudos
IhabHassan
Esri Contributor

Hi @PaulCleverleyArup 
Yes, you can use Python IDEs like VSCode or Pycharm to write python code and use arcpy or any of the packages in the default Pro python environment.
When you say "using arcpy in order to change field values", I assume here that you want to edit features in your ArcGIS Pro project. If that is correct, then I would suggest going through this doco page and sample code provided:

https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/updatecursor-class.htm

Regards

Ihab

Regards
Ihab
PaulCleverleyArup
New Contributor II
Many many thanks!

Full license available for the code. Essentially we want to update some marginalia in multiple layouts (PAGX) in a large batch from a Python program outside the ArcPro application. I've got the Python program working but not at all sure how to open/update a .PAGX file.

My next step is to try to create a new empty APRX locally, import the PAGX and update it in the context of the APRX and then export it.

I think I may be missing what the precise relationships between APRX and PAGX is?

Thanks again!

0 Kudos
IhabHassan
Esri Contributor

@PaulCleverleyArup  PAGX is a layout file, APRX is ArcGIS Pro project file.

You can import layout file into Pro project as a map using "importDocument" function of "ArcGISProject" class, more details can be found here: https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm

I am not sure if you can create an empty Pro project from the code though.
if you find any of my answers helped, feel free to mark it as a solution, that would be really appreciated. 

Regards

Ihab

Regards
Ihab
0 Kudos
PaulCleverleyArup
New Contributor II
Many thanks Ihab - I'll give it a shot!
Best wishes
Paul