Hello,
I noticed a strange behavior in the arc.env() function in the arcgisbindings package. According to the user guide, this function is supposedly grabbing the workspace folder from the GP tool environment settings. However, I noticed it ONLY grabs the Environment Settings from the main Geoprocessing menu in ArcMap, NOT the Environment Settings of the geoprocessing script tool. See my example and attached figures.
1- Setting my GP tool environment settings workspace to custom folder on disk
2- The tool runs but arc.env() is not affected by custom change and still return default Settings ".../ArcGIS/Default.gdb":
3- I now change the GP menu Settings in ArcMap to match those of my GP tool, and the arc.env() path is now grabbed correctly:
Is this intended behavior or a bug?
Solved! Go to Solution.
Francesco,
This issue (#9 on Github) is now fixed in the latest (1.0.0.125) version of the R-ArcGIS bridge. Let us know if you notice any issues around this.
Cheers,
Shaun
what is a geoprocessing environment and this one are good links
environment-levels-and-hierarchy If in doubt, for each tool, at the bottom of each page, is sometimes/generally a list of the environments that a specific tool honors. There can be differences in what is honored and the priority of the environments themselves.
Exactly, I am saying that tool settings should ovveride application settings, as per environment-level hierarchy, but currently arc.env() does not seem to do so. My examples shows that even though my tool settings point to a custom folder on my PC, the application settings still do not get overridden, given that arc.env()$workspace still grabs the application, not the tool as it should.
I couldn't find that tool listed, so I have no idea what it says at the bottom of the tool's help description. I just know that some tools in arctoolbox, the order of precedence may not be what is expected or is ignored when you don't expect it.
You can take any custom script tool that uses R-bridge, it does not matter what I used, because for sake of example I am only printing the workspace path in the tool message window. As long as you use arc.env()$workspace to your R script, you can reproduce my example with any custom script. What I am getting at is that I need to tell the R script to save a derived output to the scratch folder. In arcpy, one can use arcpy.env.scratchFolder and then use SetParameterAsText() to return a derived output, but in R this must change...do you know how I can write a derived output to a scratchFolder inside my R script and then sending it back to the GUI?
Ahh I didn't see that this was posted in the R-bridge place.. Then I would agree, something is amiss. The tool or ArcMap needs to be in charge of environments, you might get a quicker response by flagging this on GitHub as well
Francesco,
This issue (#9 on Github) is now fixed in the latest (1.0.0.125) version of the R-ArcGIS bridge. Let us know if you notice any issues around this.
Cheers,
Shaun