1

I have multiple shapefiles. When it becomes one layer (one shapefile) the volume of shapefile gets over the limit of its capacity (I believe 4GB? is the limit of *.shp can have)

Therefore, I need to save them into FGDB using ogr2ogr

this is the code I came out with so far.

for %f in (*disp_line.shp) do (if not exist test.gdb (ogr2ogr -progress --config shape_encoding "UTF-8" -f "filegdb" test.gdb %f -lco encoding="UTF-8") Else (ogr2ogr --config shape_encoding "UTF-8" -progress -f "filegdb" -update -append test.gdb %f -nln test_layer -lco encoding="UTF-8"))

when I see the result.. I get two layers. enter image description here

t_sc1disp_line feture class has 20 rows and test_line has 286 rows it is supposed to be 306 rows (20+286)..

What it means is that I have to merge the layers once again using QGIS or ArcGIS GUI tools.

Could you fix my weird OGR2OGR command?

  • Add -nln test_line to the first command of the loop as well. Now you create first layer with the default name and only after that append the rest of the layers into "test_line". Did you really use -nln test_layer and got test_lineas a result? – user30184 May 24 '18 at 7:26
  • @user30184 you are right just adding -nln test_line at the first loop solved the issue. thanks a lot. and of course i didn't use -nln test_layer for my command. i made up with the -nln tag the example above. – Pil Kwon May 24 '18 at 7:35
  • The shapefile limit is 2Gb, not 4Gb, for each file. – Vince May 24 '18 at 18:20
2

base on on @user30184 the code should be changed to

for %f in (*disp_line.shp) do (if not exist test.gdb (ogr2ogr -progress --config shape_encoding "UTF-8" -f "filegdb" test.gdb %f -nln test_line -lco encoding="UTF-8") Else (ogr2ogr --config shape_encoding "UTF-8" -progress -f "filegdb" -update -append test.gdb %f -nln test_line -lco encoding="UTF-8"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.