Opened 15 years ago
Closed 13 years ago
#2771 closed enhancement (fixed)
ogr2ogr mistakenly confusing a shapefile as a dataset
Reported by: | ldeshazer | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.8.0 |
Component: | default | Version: | 1.5.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
When trying to append one shapefile to another, ogr2ogr attempted to treat the original shapefile as a folder/complete dataset. When moving the original shapefile to its own folder and specifying a layer, the append worked properly.
(lucasd@burrito:~/rawdems/41117/h) ogr2ogr 41117.shp 1117H1DG.shp (lucasd@burrito:~/rawdems/41117/h) ogr2ogr -update -append 41117.shp 1117H6DG.shp ERROR 1: Failed to create file .shp file. ERROR 4: Failed to open Shapefile `41117.shp/1117H6DG.shp'. ERROR 1: Terminating translation prematurely after failed translation of layer 1117H6DG (lucasd@burrito:~/rawdems/41117/h) ls 1117H1DG 1117H6DG 1117H7DG 1117H8DG 41117.dbf 1117H1DG.dbf 1117H6DG.dbf 1117H7DG.dbf 1117H8DG.dbf 41117.shp 1117H1DG.shp 1117H6DG.shp 1117H7DG.shp 1117H8DG.shp 41117.shx 1117H1DG.shx 1117H6DG.shx 1117H7DG.shx 1117H8DG.shx (lucasd@burrito:~/rawdems/41117/h) mkdir 41117; mv 41117.* 41117/ (lucasd@burrito:~/rawdems/41117/h) ogr2ogr -update -append 41117/41117.shp 1117H6DG.shp -nln 41117 (lucasd@burrito:~/rawdems/41117/h)
Change History (2)
comment:1 by , 15 years ago
comment:2 by , 13 years ago
Milestone: | → 1.8.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Type: | defect → enhancement |
Note:
See TracTickets
for help on using tickets.
Actually, you don't need to move the 41117.shp in a subdirectory, but the -nln argument is necessary.
So, "ogr2ogr -update -append 41117.shp 1117H6DG.shp -nln 41117" should work.
If you don't specify -nln, ogr2ogr will try to add a new layer named 1117H6DG inside the 41117.shp file, which is impossible.
I admit it would be good if the -nln could be added automagically in that situation, but I don't really see how to do that without writing a nasty hack in ogr2ogr.cpp.