PSU-CSAR / vb-bagis-h

Source code for BAGIS-H ESRI Add-In
0 stars 0 forks source link

AGS Pro errors with feature classes converted from shapefiles by BAGIS Tools #45

Open lbross opened 3 years ago

lbross commented 3 years ago

We use ArcMap BAGIS tools to convert Weasel AOI's to BAGIS FGDB format so that they can be consumed by the Pro batch tool. When Pro calls the Expand method on one of these polygons, it throws the error: 'GeometryObjectException: An operation on an empty geometry was attempted.' This happens on aoi_v when displaying the maps. We used the CopyFeatures GP tool to migrate the shapefiles to an FGDB. Is there another tool that will work better and avoid this error?

lbross commented 3 years ago

Using the FeatureClassToFeatureClass tool instead of CopyFeatures seemed to work. Posted new add-in for BAGIS-H

lbross commented 3 years ago

We have been having a problem with Pro setting the envelope correctly when using the batch file tool to display maps for > 1 AOI. I tracked it down to Pro reporting the corners of the envelope of aoi_v as 0. So when we try to Expand the extent and set the activeView to that extent, it doesn't do anything in the map display. I copied the aoi_v file within Pro and Pro then reported the extent correctly.

I suggest converting the Weasel to FGDB tool for Pro. I am worried that we may run into other issues like this in the future with converted feature classes and rasters. It may not be the best use of resources since we probably won't use it again after the batch tool project, but I can't think of a better solution. Thoughts?

lbross commented 3 years ago

So it turns out that the key to working around this bug is to rename the feature class after it is migrated to the fgdb. I spent all of the last week porting the Weasel to FGDB to Pro but still had the same problem. But renaming the file fixed this weird bug. I'm sorry that I wasted the time this week. We could have just added a rename step to the ArcMap tool.

jdduh commented 3 years ago

Thanks for troubleshooting this issue and resolving it.

lbross commented 3 years ago

Started work on supporting conversion of basins to FGDB format. This was not properly implemented in the ArcMap tool. Basins have far fewer required files than AOIs. It appears that basins only have to FGDB: surfaces.gdb and aoi.gdb. surfaces.gdb should contain 7 raster files. Weasel basins do not appear to have an unfilled dem. The aoi.gdb only contains the aoi_v vector. This is partially implemented in the DockAnalysisLayersViewModel but basins are excluded from the selection list.

lbross commented 3 years ago

One more issue with this. Some of the basin and AOI folders on CS3 have spaces in their names. If there is a space in the folder name, Pro cannot work with the grid files in the folder and doesn't identify the folder as containing an AOI. I added in some logging to identify folders with this issue when running the tool. We will need to manually change spaces to underscores for the basins and aois on CS3

jdduh commented 2 years ago

I tried the tool and it seems to work without any issue. We have around 500+ AOIs sitting in probably a few dozen subfolders. I'm thinking modifying the tool so that it does two additional things:

  1. Check for space in the AOI name and change them to underscore before the conversion
  2. Check for the immediate subfolders in a folder if they are AOIs and perform batch conversions on all the AOIs in a folder. These two additional features can save a lot of time when performing the conversion. A quick and dirty alternative is to write a separate script to rename the AOIs and generate a text file containing the path to these AOIs. Then modify the conversion tool to read from this text file and populate the list of AOIs in the listbox.
lbross commented 2 years ago
  1. Assume that the folder names don't have spaces. Separate tool to replace spaces with underscores
  2. Re-use logic from PDF exporter tool to iterate through all subfolders and identify AOIs. Need to check file system to know if it is an AOI and add it to the list. Also need to check to see if already converted and exclude those.
lbross commented 2 years ago

I have posted the complete set of reports from Marias_R_nr_Shelby to the portal so that you have something to share with NWCC on Wednesday. Unfortunately I ran into the problem with Pro not being able to read the extent of the converted aoi_v for this AOI. I didn't realize this was the problem until I got partially through the report creation. I'm going to pause on the report creation and see if I can get this bug fixed in the Pro conversion tool. I ran the batch export tool for another of the AOIs and it was fine, so not sure what is going on. Let me know if you see any issues with the Marias_R_nr_Shelby output.

lbross commented 2 years ago

I copied the original weasel files for Marias_R_nr_Shelby to my laptop and ran the ArcGIS Pro tool to upgrade the AOI to FGDB format. I then created a couple of analysis layers and loaded the maps. The extent was correct. Do you remember if you used the BAGIS-H tool or the BAGIS-PRO tool to migrate the 17 AOIs to FGDB? If BAGIS-H then that's probably where the extent bug came from. If Pro ... I don't know ...

jdduh commented 2 years ago

I used the BAGIS-H tool, not the Pro tool. That probably explains why. Please post a copy of the Pro addin when it becomes stabilized after all the enhancement requests are accounted for. Thanks!

lbross commented 2 years ago

I am relieved. I posted an updated version of the addIn to basins server. It should be fairly stable. Also forgot to tell you that there are a couple of older reports on the portal. I left them there as test data so that I could try updating the fields through ArcGIS Pro to prepare for adding AOIs programmatically. This way I am not updating the "official" copies.