[gdal-dev] Appending to a single feature class in a gdb via ogr2ogr

Even Rouault even.rouault at spatialys.com
Tue May 12 14:10:19 PDT 2020

On lundi 27 avril 2020 12:02:57 CEST Maggie Wooten wrote:
> First, I apologize if I am using this mailing list improperly. This is my
> first time here.
> I am trying to iterate over some shapefiles (109 shapefiles to be exact)
> and append them to a *single* feature class in an output geodatabase, but
> the resulting output geodatabase is one with 100 feature classes that looks
> like this:
> INFO: Open of `output.gdb' using driver `FileGDB' successful.
> 1: output (Multi Polygon)
> 2: output_1 (Multi Polygon)
> 3: output_1_2 (Multi Polygon)
> 4: output_1_2_3 (Multi Polygon)
> 5: output_1_2_3_4 (Multi Polygon)
> .....
> 99:
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_
> 27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_98 (Multi Polygon)
> 100:
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_
> 27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_99 (Multi Polygon)
> These are the commands I'm running in the iteration:
> if i == 0: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -f
> "FileGDB" output.gdb input1.shp"
> else: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -update
> -append -f "FileGDB" output.gdb inputX.shp"
> What am I doing wrong here?

I'm not sure. I've just tried to replicate your issue with:

ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -f "FileGDB" output.gdb  poly1.shp
ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -update -append -f "FileGDB" 
output.gdb poly2.shp

and I get a single 'output' layer in the GDB with the features of the 2 input layers 
concatenated. This is with GDAL 3.1/master and FileGDB SDK 1.5.1

Looking at the driver code, I can see a layer renaming strategy, but that shouldn't normally be 
triggered with the -update -output flag of ogr2ogr. And my understanding of that renaming 
strategy is that it should rather result in names like output, output_1, output_2, etc. 

Spatialys - Geospatial professional services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200512/426c9166/attachment.html>

More information about the gdal-dev mailing list