POST
|
Hi All, I was trying to use a point feature class (~1500 points) from a file geodatabase for the Train Support Vector Machine Classifier tool. This feature class crashed my python script and my code in the interactive python window. When I tried using the feature class in the interactive tool from the Toolbox, the tool crashed as soon as I dragged the feature class into the parameter location in the tool window. I tried Checking/Repairing Geometry of the feature class and Recover File Geodatabase for the full feature class, but still had the same issue. I exported the point feature class to a shapefile and it is working just fine in my script. This is very disconcerting because there is no indication that there is anything wrong with the feature class or the geodatabase, so it was very confusing to debug. It makes me want to steer clear of file geodatabases all together Anyone else run into this sort of thing? Or have any suggestions for debugging/identifying/fixing when there is a problem with a feature class in a file geodatabase.
... View more
04-10-2019
11:47 AM
|
0
|
0
|
258
|
POST
|
This was extremely helpful. I had a very simple File Geodatabase with 5 feature classes in it. One of the feature classes was a set of ~1500 points that I spent most of a day creating. As I was editing, I saved the features frequently. The next day when I opened the MXD, the point feature class was completely empty! There were no error messages about a corrupt geodatabase, just an empty data table. I tried the Recover File Geodatabase tool, but it did not recover the missing points. Fortunately, thanks to your info, I was able to use GDAL on the command line to "find" and restore those points. When using ogrinfo, The default GDAL read-only FGDB driver (OpenFileGDB) found a discrepancy between a *.gdbtable and a *.gdbtablx and alerted me: Warning 1: File ts3_yp.gdb/a0000000e.gdbtable (layer trainingpts_aldflh) declares 1511 valid records, but ts3_yp.gdb/a0000000e.gdbtablx declares only 0 total records. Using that later value for safety (this possibly ignoring features). You can also try setting OPENFILEGDB_IGNORE_GDBTABLX=YES to completely ignore the .gdbtablx file (but possibly retrieving deleted features), or set OPENFILEGDB_USE_GDBTABLE_RECORD_COUNT=YES (but that setting can potentially cause crashes) Feature Count: 0 I tested setting the two environment variables: When I set OPENFILEGDB_IGNORE_GDBTABLX=YES, ogrinfo did not see the feature class at all. But, when I set OPENFILEGDB_USE_GDBTABLE_RECORD_COUNT=YES, ogrinfo listed the 1511 records. I was then able to use ogr2ogr to export the points from the geodatabase to a shapefile (or csv or other format) and restore my data! For the record, I am working on ArcMap v.10.6 on a Mac running Parallels for Windows applications. I save the data onto a folder on the Mac drive, not the Parallels "C" drive. I have not previously had any issues with this workflow and have been using it since 2013. I have never run into this situation where data completely disappeared from a file geodatabase and I'm very appreciative for this thread so I could work through a solution to retrieve it.
... View more
04-03-2019
05:03 PM
|
2
|
0
|
2036
|
POST
|
I recently found this paper about a tool to calculate texture metrics in ArcMap, but have not found the code and/or tool. https://doi.org/10.1016/j.cageo.2013.10.011 Does anyone know if this is available?
... View more
02-28-2019
11:19 AM
|
0
|
0
|
1405
|
POST
|
Thanks Josh. Yeah, I agree, conceptually it all makes sense and relies on getting the page coordinates set up for the clipping. It just seems a bit cumbersome to have to go through so many steps to implement a checkbox function that ESRI has already coded! Because my workflow did not include hundreds of images, I fell back on the manual method, but I would probably try to automate if I was in your shoes. Good luck!
... View more
06-27-2018
09:37 AM
|
0
|
0
|
1437
|
POST
|
Hi Josh, Sadly, no, I did not get any replies and just defaulted to manually exporting them from the ArcMap interface. I am using ArcMap 10.4, so I do not know if this option was added to the arcpy.mapping library in a later version or in ArcPro. If you do come up with a solution, please post back to this thread. Allison
... View more
06-27-2018
08:36 AM
|
0
|
2
|
1433
|
POST
|
I have a set of mxds that I would like to automate the process of printing to a PNG. These files will be incorporated into other documents, so I need to remove the whitespace around the edge of the layout. I can do this from the ArcMap interface using "Clip Output to Graphics Extent.", but there is no parameter in the ExportToPNG function to replicate this process in arcpy.mapping. See: arcpy function to Clip Output to Graphics Extent Similar questions have been posed on this board, Clip Output to Graphics Extent with arcpy Arcpy.mapping Get the extent of the map elements. but I need a little more clarification about how to actual automate the process with the version of Python and associated libraries that are installed with ArcMap (if that is, in fact, possible). I can get the max/min extent of the layout elements, (in page units) using arcpy.mapping.ListLayoutElements(), but I'm not sure how I can then use those values within the script to constrain the output image extent. Is this possible? Or do I need to use an external graphics library as mentioned by Gerry Gabrisch? The use of Data Driven Pages functionality was mentioned, but the specifics of this approach are not clear to me, since I have not used them before. At first glance seems like a bit of a cumbersome approach for a simple need to get rid of white space around the edge of the page, but I'm open to using it if it's possible to automate the whole process. My layouts are often made up of several data frames as well as some individual graphic and text elements, so I'm not sure if that has any implications for use of the DDP approach. In addition, the mxds that I would like to print, are not necessarily related to each other, I just want to be able to batch export a set of maps. Thanks for any code snippets, tips, or ideas. Cross-referencing to mapping group: https://community.esri.com/community/gis/mapping
... View more
11-09-2017
06:32 PM
|
0
|
6
|
2783
|
POST
|
Ah ha! Thank you Joshua! That solved it. Really helpful info. So, that explains why similar code I wrote (using arcpy.Exists) for the Validator of the Toolbox worked and this code didn't. I don't remember changing/updating the interpreter in PyCharm -- it may have happened when I upgraded recently without me realizing it.
... View more
09-01-2017
01:01 PM
|
0
|
3
|
333
|
POST
|
Thanks James and Dan. I used os.path.join in my original code, but was just testing with the raw strings to make it more explicit what was happening. Turns out it does work correctly with tables in a file geodatabase, regardless of the "funkiness" of the path. I'm still bothered by the fact that the same code works correctly in the interactive window correctly, but not in my script. My IDE is using C:\Python27\ArcGISx6410.4\python.exe to run the script, so that looks like the right version to me. Guess I'll work with ListTables instead and check against the list.
... View more
09-01-2017
12:44 PM
|
0
|
5
|
905
|
POST
|
Looks like a couple similar (irreproducible) bugs in the past: Esri Support Search-Results
... View more
09-01-2017
11:59 AM
|
0
|
0
|
905
|
POST
|
Sadly, same result -- False when run in script, True when run from interactive window.
... View more
09-01-2017
11:50 AM
|
0
|
1
|
905
|
POST
|
Thanks Dan, I also had concerns about the funky path, but as I mentioned, the arcpy.Exists() work for the geodatabase itself, which implies to me that the path is not the problem. Also, I am writing code for others to use, so I don't have control over their file-naming convention or the type of geodatabase they are using. If that is the problem, I will need to find a different way to code this check, but it would be nice to know why the Exists function is so inconsistent.
... View more
09-01-2017
11:38 AM
|
0
|
3
|
905
|
POST
|
hmmm... I just had a very similar result, but it was simply with table inside a personal geodatabase. Did you find a solution?
... View more
09-01-2017
11:32 AM
|
0
|
1
|
1941
|
POST
|
I am having trouble with the arcpy.Exists() function in a script to check the existence of a table in a personal geodatabase. When I test in the ArcToolbox Python window, I get the correct result, True, for a table that exists. When I use the same commands in a stand-alone script, regardless of how I construct the path string, it always returns False for the table. I also tested just the geodatabase, and it returns True, so it is not having trouble finding the geodatabase itself. Below is the code from the script. When I run from the interactive window, I just remove the print statement. import arcpy print arcpy.Exists("Y:/projects/dnr_svmp2016/db/SVMP_2000_2015_DB.v52_20170803/SVMP_DB_v5.2_20170803_AB.mdb/site_samples") print arcpy.Exists("Y:\projects\dnr_svmp2016\db\SVMP_2000_2015_DB.v52_20170803\SVMP_DB_v5.2_20170803_AB.mdb\site_samples") print arcpy.Exists("Y:\\projects\\dnr_svmp2016\\db\\SVMP_2000_2015_DB.v52_20170803\\SVMP_DB_v5.2_20170803_AB.mdb\\site_samples") print arcpy.Exists("Y:/projects/dnr_svmp2016/db/SVMP_2000_2015_DB.v52_20170803/SVMP_DB_v5.2_20170803_AB.mdb") This script returns: False False False True Here is screenshot of the interactive window: I'm hoping that the solution is something very obvious that I am just missing right now! Thanks for any help.
... View more
09-01-2017
11:25 AM
|
0
|
14
|
1774
|
POST
|
I am creating a python Toolbox that has the user select a geodatabase, and uses a hard-coded list of tables and associated field names to set the Value List filters for four additional parameters using the unique values in each of the specified fields. So, in the updateParameters code, I am checking for the presence of each table and associated field, and if they exist, setting the parameter's filter list to the unique values. If not, I am clearing the filter list (set to []), and disabling the parameter. If the geodatabase does not contain the table/tables or field/fields needed to create the Value List filters, I would like to provide a custom error message to let the user know that the geodatabase is missing some of the necessary tables/fields. However, it appears I cannot use setErrorMessage in updateParameters because it does not show up in the user interface. And, in this case, because there will be internal errors (some missing values, because the parameter has been disabled), it looks like updateErrors does not get called. I'm not sure about this last statement, because I am a bit unclear about how these class methods interact with what ArcGIS is doing behind the scenes. I have combed the ESRI docs for custom toolboxes, as well as other materials that I could find, but am still have challenges with the code due to not quite knowing how these things flow. Most of the code examples I've found are quite simple and/or do not use these methods, so I'm interested in finding other examples that might help clarify this issue. As a related question, I am having some challenges with use of the "altered" versus "hasBeenValidated" parameter. Some additional examples of comparing usage of these parameters would be helpful.
... View more
07-27-2017
01:01 PM
|
1
|
0
|
409
|
POST
|
Thanks all. It totally agree that using a spatial reference is a best practice. The script was a work-in-progress to learn about pandas, numpy and conversion to a feature class, so I wasn't yet concerned with the spatial reference specifics. Now I have learned, as Joshua demonstrated, that there may be unexpected results if spatial reference is not provided. And, Vince, I did not know, until now (after ~20 years of experience with ESRI products) that the default ("unknown") spatial reference assumes units of meters and coordinate precision of millimeters.
... View more
12-29-2016
02:16 PM
|
0
|
1
|
636
|
Title | Kudos | Posted |
---|---|---|
2 | 04-03-2019 05:03 PM | |
1 | 07-27-2017 01:01 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|