2

I know Esri provides scripting capacity, via the Python window, but I've had a hard time with it. Making the jump from the Field calculator to the Python window was too much to me. Trying to keep 3 different sets of syntax straight (Esri, VBA, and Python) was misery (Esri doesn't care about caps or whitespace, Python does...)

Starting use RStudio as a GIS. One of the reasons I'm starting to move from ArcGIS to R is the need for reproducibility in my analysis. Much of the analysis I'm doing is scripted. But wondering if there is a way to keep using Esri.

One of the features I really like RStudio about it is the Console, which acts as a command line interface. But it also logs the equivalent of the command line code you would have typed in when you run something from the GUI. This has been very very helpful in learning R.

Is there an equivalent for the Python window, so I could see the inputs from my GUI in Esri as the equivalent Python output code?

That would make translating GUI inputs into a Python script much much easier. It would also make reproducing analysis much easier, as I'm repeatedly being called on to perform similar analyses, but months apart.

Using 'Record Macro' in EXCEL to record the VBA equivalent of my GUI commands, and then editting the VBA code to create a new script/macro.

Is there a similar way to document my workflow in ArcGIS?

Related:

3

It is not included in the ArcGIS install, but adding the iPython Notebook to your workflow sounds like exactly what you're looking for.

  • It appears to be an excellent tool for learning Python. Does it play well with ArcGIS? – Mox Dec 22 '14 at 21:23
  • It works all right, with the occasional nasty surprise in 10.2. It should behave better in 10.3 as well and in ArcGIS Pro. The basic command-line iPython tool will work fine with all recent ArcGIS versions, and the Python Window will let you save your input/outputs as well to get a rough approximation of the expected input/output nature of iPython. – Jason Scheirer Dec 22 '14 at 21:46
1

You may want to add your vote to the ArcGIS Idea to have a Record macro option in ArcMap:

I think a record macro option should increase a lot of people's workspeed with ArcMap, without needing highend programming skills, similar as in MS Excel.

  • 1
    Based on the nature of the problem, the impedance mismatch of Win32 events/ClassIDs/ICommands/Dialog Inputs/Python APIs and the architecture of the application, a "record macro" command will probably never happen in the 10.x series. ArcGIS Pro's tasks are the implementation of what you're looking for. – Jason Scheirer Dec 22 '14 at 22:43
  • +1 @JasonScheirer I figured that would be a case and some experimenting I did with recording for ArcGIS Pro tasks during Beta looked promising. – PolyGeo Dec 22 '14 at 22:48
0

Years later, it seems it has become feasible (for some tools), to after running, in the Results box, to right-click and select 'copy as Python Snippet'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.