Closed jdduh closed 5 years ago
Are you using the DEM from the web services or a file? I just tested twice with a file and did not get the error. I have seen a similar error when the temporary space where ArcMap writes the files gets cluttered. Did you try cleaning out the ArcMap files from C:\Windows\System32? Obviously It happens on > one computer since you tested with different ArcMap versions. Any ideas on how I could replicate? There aren't any files to share :-(
This is the code that smooths the DEM: Public Function Smooth(ByVal pRaster As IGeoDataset2, height As Double, width As Double) As IGeoDataset2 ' Declare Variables Dim pNBOp As INeighborhoodOp = New RasterNeighborhoodOp Dim pSmooth As IGeoDataset2 = Nothing Dim pNB As IRasterNeighborhood = New RasterNeighborhood
pNB.SetRectangle(width, height, ESRI.ArcGIS.GeoAnalyst.esriGeoAnalysisUnitsEnum.esriUnitsCells)
Try
' Create HydrologyOP and Complete Function
pSmooth = pNBOp.FocalStatistics(pRaster, ESRI.ArcGIS.GeoAnalyst.esriGeoAnalysisStatisticsEnum.esriGeoAnalysisStatsMean, pNB, True)
Catch ex As Exception
MsgBox("Smooth Exception: " & ex.Message)
Finally
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pNB)
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pNBOp)
End Try
Return pSmooth
End Function
Same problem for the Create AOI from a shapefile tool. Can you explicitly set the scratch workspace?
I can try to set the scratch workspace. What do you want me to set it to? It has to be something that will be accessible from everyone's computer. Alternatively, I can swap out the Geoprocessor for the ArcObjects code which will likely solve the problem. This will be a little slower because I need to save the file to disk in between.
I think the issue is that when a user doesn't have admin privilege the tool cannot write to the System32 folder. That's the case for both Gus and I. I remember we had similar issues on some other tools and we probably set the scratch workspace to somewhere inside the AOI folder (e.g., analysis.gdb or directly under the AOI root folder).
This is for BASIN, not an AOI so we don't have an AOI folder or an analysis folder. I can set it to the root of the basin folder? It looks like there isn't a property for scratch workspace but there is one for OutWorkspace. I will try that and see if it helps.
Sounds good. The Create AOI from a shapefile tool bypasses BASIN, but you can set the OutWorkspace to the root of the BASIN/AOI folder.
I have implemented the suggested fix. I cannot test it because I don't have the problem. It looks like it sometimes leaves behind an ras file in the outWorkspace but at least it doesn't fail. Do you want me to post a new build of BAGIS V3? I made the fix on the master branch so it doesn't include the auto pseudo site tool.
It would be great if you could post the updated version. Did you also fixed the Create AOI from a shapefile tool? I encounter the System32 access error even with the Smooth DEM unchecked on that tool.
I didn't change the release number but posted a new version here. I changed the publish date on the add-in so you can check there to see if you have the new one. The create AOI from shapefile tool shares the smooth subroutine with the Basin tool, so I assumed I fixed both. I did test both and both ran without error on my computer.
If create AOI from shapefile continues to fail, it is likely a similar problem elsewhere with a different operation. If it does continue to fail, I will need to see the error message.
It's all good.
The same problem resurfaces on BAGIS 3.2-b1. The source DEM is from our webservice.
I just checked the code and the "fix" that we tried is still there: Setting the outWorkspace. Is the error message the same? Is it still trying to write to the System32 folder? If so, I think the only option is to switch it to the GeoProcessor. I am still trying to replicate.
Here is a screenshot.
I think what you can do in July is to improve the stability of BAGIS. There are several "typical" bugs that users would encounter, but difficult to replicate by us. NWCC folks know these bugs and are able to get around them. I can set up a clean computer for you to RDP to and test the addins out.
So it is ignoring the outWorkspace that we tried to set. I found a code sample with a slightly different syntax that I am testing. Agreed that a test system with similar permissions to NWCC would be helpful. Just make me a list of what we need to work on :-)
I just posted a new add-in on GitHub that uses the different syntax to set the outWorkspace. https://github.com/PSU-CSAR/vb-bagis/releases/tag/3.2-b1. If that doesn't work, we will have to switch to Geoprocessor.
There is a SetAsNewDefaultEnvironment() method that I haven't run across until today.
That seems to be working.
Excellent! It's kind of a big deal when you can't create a Basin. I wonder if we should try setting the outWorkspace whenever a Basin or AOI is selected? According to the (minimal) documentation, if you create and configure a new RasterAnalysis object and call the SetAsNewDefaultEnvironment() method, all subsequent Analysis objects will use the set object properties. I am skeptical but it might be worth a try?
That might be true! I encountered a "reclassify" error (with similar messages related to C:\Windows\System32) when doing a site scenario analysis. The errors don't show up this time. I will reinstall the previous version to capture the error.
Explicitly set outWorkspace using syntax described above when setting Basin or AOI. Hopefully this will be inherited by the downstream tools. Also fixed bug with createAOIFromShapefile where error messages pop when clipping the prism layers from an Image Service. This is a display issue only but annoying since there are so many layers to clip.
Gus still got an error when the smooth option is enabled. Here are the error messages that he got.
Followed by this error message.
Gus is using 10.5.1. with the latest addin (3.4-b1).
See issue #68. Although the headline is deceiving, this is the issue where we were fixing the smooth.
When this option is selected, the output BASIN fails to be created.
On ArcGIS 10.2, the users get this error message.
On ArcGIS 10.4, the process seems to get into an infinite loop and hangs ArcGIS.