I am trying to merge two shapefiles from a zip obtained here: http://wsgw.mass.gov/data/gispub/shape/l3parcels/L3_SHP_M351_YARMOUTH.zip
The two shapefiles contain different attributes for the same town in Massachusetts. I want to join the two shapefiles into one consolidated shapefile with all the attribute information from both files.
I can achieve this on QGIS, however something goes wrong when I try to do this on the command line.
On the command when I do this:
$ ls *.shp
M351OthLeg.shp M351TaxPar.shp
$ ogr2ogr -f "ESRI Shapefile" consolidated.shp M351TaxPar.shp
$ ogr2ogr -f "ESRI Shapefile" -update -append consolidated.shp M351OthLeg.shp
It does produce a consolidated file that is larger than the first two:
$ ls -al *.shp
-rwxr-xr-x@ 1 ssikdar 600 249940 Feb 15 2012 M351OthLeg.shp
-rwxr-xr-x@ 1 ssikdar 600 10765676 Feb 15 2012 M351TaxPar.shp
-rw-r--r-- 1 ssikdar 600 11015516 Apr 20 21:55 consolidated.shp
But the new file is missing attributes of the second file. When I do an ogrinfo:
$ ogrinfo -so -al consolidated.shp
INFO: Open of `consolidated.shp'
using driver `ESRI Shapefile' successful.
...
SHAPE_Leng: Real (19.11)
SHAPE_Area: Real (19.11)
MAP_PAR_ID: String (26.0)
LOC_ID: String (18.0)
POLY_TYPE: String (15.0)
MAP_NO: String (4.0)
SOURCE: String (15.0)
PLAN_ID: String (40.0)
LAST_EDIT: Integer (9.0)
BND_CHK: String (2.0)
NO_MATCH: String (1.0)
TOWN_ID: Integer (4.0)
It doesn't seem to have the attributes of the last file I tried to merge with it.
$ ogrinfo -so -al M351OthLeg.shp
...
MAP_PAR_ID: String (26.0)
LEGAL_TYPE: String (15.0)
LS_BOOK: String (16.0)
LS_PAGE: String (14.0)
REG_ID: String (15.0)
SHAPE_Leng: Real (19.11)
SHAPE_Area: Real (19.11)
TOWN_ID: Integer (4.0)
TAXPAR_ID: String (18.0)
As a test I merged the two shapefile in Quantum GIS. When I do an ogrinfo on that file, the additional attributes are there:
$ ogrinfo -so -al ~/Documents/m351_qgis.shp
...
MAP_PAR_ID: String (254.0)
LEGAL_TYPE: String (254.0)
LS_BOOK: String (254.0)
LS_PAGE: String (254.0)
REG_ID: String (254.0)
SHAPE_Leng: Real (21.5)
SHAPE_Area: Real (21.5)
TOWN_ID: Integer (10.0)
TAXPAR_ID: String (254.0)
LOC_ID: String (254.0)
POLY_TYPE: String (254.0)
MAP_NO: String (254.0)
SOURCE: String (254.0)
PLAN_ID: String (254.0)
LAST_EDIT: Integer (10.0)
BND_CHK: String (254.0)
NO_MATCH: String (254.0)
Is there something I'm missing in my command line arguments that's giving me a different result than QGIS?