DOI-USGS / gems-tools-arcmap

Tools for working with the GeMS geologic map database schema in ArcGIS
Creative Commons Zero v1.0 Universal
42 stars 21 forks source link

Make Polygons tool issues #40

Open cgutierrez-01 opened 4 years ago

cgutierrez-01 commented 4 years ago

Hello,

I have been testing/using the Make Polygons tool in the GeMS Tools for Arc10.5 toolbox (2018-05-18) with decent results but ran into an issue with relationship classes. The tool fails and crashes the software if relationship classes are present in the gdb (no useful error message generated). If the relationship classes are removed the tool succeeds.

In addition, the ArcGIS Pro version of the tool doesn't appear to be working. Even if topology and relationship classes are not present, the tool fails with a reported schema lock (see error message below).

Not sure if these are known issues or if there is anything that can be done about them, but I figured I would let you know. We are currently implementing the GeMS schema in our organization and would like to utilize the tools as much as possible. Thanks to the GeMS team for all your hard work developing these tools.

OS: Windows 10 Enterprise v 1803 S/W: ArcGIS Desktop 10.7.1 ArcGIS Pro 2.4.2

image

ethoms-usgs commented 4 years ago

Carlos (is that right?), Thanks for getting in touch.

The behavior you are describing in the first part of your message probably has to do with the fact that the tool, depending on your input parameters, is either trying to rename MapUnitPolys or delete it while it is participating in a relationship class. Unfortunately, you can do this manually in ArcCatalog, so I don't know why the code would be bombing. But if it didn't crash, your relationship class would just be deleted, which isn't what you want either. In either case, since you have found that it will work if the relationship classes are removed first, I'm going to punt at this point and say you have found a workaround. If I were to change the code, and I hope I can soon, I would have it check for a relationship class, delete it if possible, rebuild the map unit polygons, and then rebuild the relationship class.

Your second issue: finding and removing schema locks can be very frustrating. All I can suggest is that you close everything that might be touching, or recently touched, the geodatabase and then try again. Orphaned python processes sometimes hang onto schema locks even when it appears they have stopped running. They should disappear once the program has been shut down.

You might also look inside the geodatabase as a folder in Windows Explorer and try to delete any *.lock files you find. Those are not always properly deleted when they should be.

cgutierrez-01 commented 4 years ago

Hi Evan,

Thanks for the quick reply and for pointing out the issues/limitations with the relationship classes.

I am still a bit perplexed by the schema lock issue. Following a full reboot, I have ensured that the gdb is not being accessed by another application and verified that no schema locks are present in the gdb folder prior to loading the features classes into ArcPro, but still get the error.

ethoms-usgs commented 4 years ago

Carlos, I apologize. The script was failing because of some code that was trying to determine if a schema lock could be placed on a geodatabase and exiting if it found one could not. Maybe this worked for me as expected some time ago, but it clearly isn't now. I have removed that section of code and updated the script. You can download just that script (https://github.com/ethoms-usgs/GeMS_Tools/blob/master/Scripts/GeMS_MakePolys3_AGP2.py - click Raw and then copy and paste the text to a file with the same name) or download the attached .txt file and rename it .py.

GeMS_MakePolys3_AGP2.txt

cgutierrez-01 commented 4 years ago

Great! Thanks, Evan. I was wondering if commenting out that section would work. I'll try this out tomorrow. Thanks again.

-Carlos


From: Evan Thoms notifications@github.com Sent: Wednesday, January 15, 2020 2:55:23 PM To: usgs/GeMS_Tools GeMS_Tools@noreply.github.com Cc: Gutierrez, Carlos@DOC Carlos.Gutierrez@conservation.ca.gov; Author author@noreply.github.com Subject: Re: [usgs/GeMS_Tools] Make Polygons tool issues (#40)

Carlos, I apologize. The script was failing because of some code that was trying to determine if a schema lock could be placed on a geodatabase and exiting if it found one could not. Maybe this worked for me as expected some time ago, but it clearly isn't now. I have removed that section of code and updated the script. You can download just that script (https://github.com/ethoms-usgs/GeMS_Tools/blob/master/Scripts/GeMS_MakePolys3_AGP2.pyhttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fethoms-usgs%2FGeMS_Tools%2Fblob%2Fmaster%2FScripts%2FGeMS_MakePolys3_AGP2.py&data=02%7C01%7Ccarlos.gutierrez%40conservation.ca.gov%7C86bc1b741245455edfd608d79a0e01a9%7C4c5988ae5a0040e8b065a017f9c99494%7C0%7C1%7C637147257268260869&sdata=26yKqlTdmOnoVpV15DiEUbHK2S15Y33C2rzh2Gd81PQ%3D&reserved=0 - click Raw and then copy and paste the text to a file with the same name) or download the attached .txt file and rename it .py.

GeMS_MakePolys3_AGP2.txthttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusgs%2FGeMS_Tools%2Ffiles%2F4067933%2FGeMS_MakePolys3_AGP2.txt&data=02%7C01%7Ccarlos.gutierrez%40conservation.ca.gov%7C86bc1b741245455edfd608d79a0e01a9%7C4c5988ae5a0040e8b065a017f9c99494%7C0%7C1%7C637147257268270865&sdata=F4i4zB%2BP%2F7%2BUf%2BS02amW2cNB0ucFtF0kc1YhPlflsN4%3D&reserved=0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusgs%2FGeMS_Tools%2Fissues%2F40%3Femail_source%3Dnotifications%26email_token%3DAOI6JKFYTNM37YSIKUV4GV3Q56H5XA5CNFSM4KHFZZ5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCDKIY%23issuecomment-574895395&data=02%7C01%7Ccarlos.gutierrez%40conservation.ca.gov%7C86bc1b741245455edfd608d79a0e01a9%7C4c5988ae5a0040e8b065a017f9c99494%7C0%7C1%7C637147257268270865&sdata=%2FEEgsd4%2BVTU%2BBvDtcZKiSOtS6WKsdfNecvSGo9xC%2FrY%3D&reserved=0, or unsubscribehttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOI6JKFCKTUNQZMZMS3GU4LQ56H5XANCNFSM4KHFZZ5A&data=02%7C01%7Ccarlos.gutierrez%40conservation.ca.gov%7C86bc1b741245455edfd608d79a0e01a9%7C4c5988ae5a0040e8b065a017f9c99494%7C0%7C1%7C637147257268280853&sdata=5P2DBU8OD3HkZFm32l%2FFX1GuPfcSGLFb5T7RXD3Du1Q%3D&reserved=0.

ethoms-usgs commented 3 years ago

Carlos, See Issue 59 and note that the tool has changed since you logged this issue. Does the tool work for you now?

cgutierrez-01 commented 3 years ago

Thanks for the follow-up, Evan. The tool works fine in ArcMap if relationship classes are not present. Unfortunately, the tool still does not work in ArcMap if relationship classes and does not work at all in AcGIS Pro. In ArcMap the whole application bombs and in ArcGIS Pro I get the following error message (same error with or without the relationship classes):

Traceback (most recent call last): File "G:\CGS\GM_Work\Arcwork\ArcGIS_Files\GeMS\test\cg_testing\gems-tools-pro-master_20210315\Scripts\GeMS_MakePolys3_AGP2.py", line 319, in arcpy.DeleteFeatures_management(blankPolys) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3910, in DeleteFeatures raise e File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3907, in DeleteFeatures retval = convertArcObjectToPythonObject(gp.DeleteFeatures_management(gp_fixargs((in_features,), True))) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 511, in return lambda args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset D:\Temp\250K_State_Geology\ATLAS_new\Weed\Test\pro\Weed_GeMS.gdb\GeologicMap\errors_unlabeledPolys does not exist or is not supported Failed to execute (DeleteFeatures). Failed to execute (MakePolys).

ethoms-usgs commented 3 years ago

Ok, I can see that happening. The tool would have to detect a relationship class, delete it, recreate MapUnitPolys and then re-create the relationship, which it doesn't do now. We'll add that to the list.

I will try to look at the Pro version soon. Thanks for the update.