Is there a way to merge multiple feature classes into one feature class in a geodatabase with ogr2ogr? If this isn't possible with ogr2ogr, is there another method? I'm using the ESRI File Geodatabase driver for GDAL.
If the solution could merge all feature classes in a geodatabase matching a particular string, that would be even better!
org2org command I'm using to merge geodatabases, which works well but creates an unwieldy number of feature classes:
ogr2ogr -f 'FileGDB' -update -append merged.gdb gdbtomerge.gdb
Here is the structure of the geodatabase feature classes i'd like to merge:
geodatabase #1 feature classes (multipolygon) to merge:
geodatabase #2 feature classes (multipolygon) to merge:
There are no attributes for any of the features except for SHAPE_Length and SHAPE_Area for all feature classes. Ideally I'd like to give each feature a text attribute with the feature class name, but that is out of the scope of this question I think. Just merging all of the feature classes that either match the string 'Frm' or even the same geometry type would work.
I think I've gotten a little closer using SQL expressions with ogrinfo:
-drop a table (feature class):
ogrinfo -dialect FileGDB -sql "drop table tabletodrop" geodbname.gdb
-I tried this to merge two tables but I get: '(Cannot acquire a lock.)' with this command:
ogrinfo -dialect FileGDB -sql "INSERT INTO table01 SELECT * FROM table02" geodbname.gdb
Any thoughts on the lock issue or a better way to do this?