#4358 closed defect (wontfix)
Shapefile: -update -append -nln WrongNameHere
Reported by: | peifer | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
Below I am re-using the shapefile created for ticket #4357. I am not sure if this is expected behaviour or should there perhaps be a warning, something like: shapefile name and new layer name do not match -- are you sure that you want to create a new shapefile?
$ ogr2ogr -t_srs epsg:3035 ~/tmp/out.shp EBM_A.shp -where "TAA = 4" -update -append -nln WrongNameHere $ ls -l ~/tmp -rw-r--r-- 1 peifer mtr 12717 Nov 30 06:16 out.dbf -rw-r--r-- 1 peifer mtr 369 Nov 30 06:16 out.prj -rw-r--r-- 1 peifer mtr 1700396 Nov 30 06:16 out.shp -rw-r--r-- 1 peifer mtr 1716 Nov 30 06:16 out.shx -rw-r--r-- 1 peifer mtr 24311 Nov 30 06:29 WrongNameHere.dbf -rw-r--r-- 1 peifer mtr 369 Nov 30 06:29 WrongNameHere.prj -rw-r--r-- 1 peifer mtr 685040 Nov 30 06:29 WrongNameHere.shp -rw-r--r-- 1 peifer mtr 3212 Nov 30 06:29 WrongNameHere.shx
Change History (2)
comment:1 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Thanks for the explanations. Good to know that I can forget about -nln when appending to shapefiles.
Note:
See TracTickets
for help on using tickets.
Yes I agree this is a weird use case. I had detected that some time ago, and here's the comment I put in the code of the shapefile driver (ogrshapedatasource.cpp, l559)
This has existed for a number of past versions, so although suspicious, there are potential users that rely on that behaviour, so I'm tempted to let that as such.
However, you should now that there are now tweaks in ogr2ogr, so that you just remove the -nln argument. ogr2ogr will autodetect that the target datasource is a single layer datasource and automatically append to it layer. So the following should work :
Note that I've also removed -update. Since OGR 1.8.0, -append and -overwrite automatically trigger -update.