Does arc.env() get workspace only from GP menu settings?

1136
6
Jump to solution
03-16-2017 07:06 AM
FrancescoTonini2
Occasional Contributor II

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?

0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor

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

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

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.

0 Kudos
FrancescoTonini2
Occasional Contributor II

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.

0 Kudos
DanPatterson_Retired
MVP Emeritus

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.

0 Kudos
FrancescoTonini2
Occasional Contributor II

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? 

0 Kudos
DanPatterson_Retired
MVP Emeritus

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

0 Kudos
ShaunWalbridge
Esri Regular Contributor

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