[Gdal-dev] Append two shapefiles
Alex Mandel
tech_dev at wildintellect.com
Mon Dec 5 15:29:13 EST 2005
Ed McNierney wrote:
> Alex -
>
> The "2 additional fields" means that the DBF file (attributes) has two
> columns in one file that aren't in the other. The DBF file can be
> edited by itself using any DBF editor (Microsoft Excel will work on
> Windows). Add two columns to the "short" DBF file and save the edited
> version. You should then have two matching shapefiles that you can
> concatenate.
>
> - Ed
>
> Ed McNierney
> President and Chief Mapmaker
> TopoZone.com / Maps a la carte, Inc.
> 73 Princeton Street, Suite 305
> North Chelmsford, MA 01863
> ed at topozone.com
> (978) 251-4242
>
> Goal: Append two shapefiles together. One of the shapefiles has 2
> additional fields(shp2).
>
> Preferable solution is to hook into a python module in the FWtools or
> GDAL but I haven't figured out how to import ogr.py yet it since import
> gdal returns an error Numeric not found and I havne't quite fiqured out
> how to import from the FWtools, I tried copying the pymod folder to my
> sites-packages but I guess that doesn't work because there's no
> __init__.py, maybe I should just make one?
Well yes, that works for one file. But I'm trying to write a program
that does this for the user automatically. I was under the impression
that the append could work and it would by default only copy fields that
are the same.
But copying the aspatial data isn't really the issue, I've manually done
this with dbflib from shapelib. I just can't figure out how to copy my
points so that it's a valid shapefile.
On that note I just tried to append two shapefiles that have identical
fields and ogr2ogr.exe after looking like it was working crashed and
produced a windows error log.
>ogr2ogr -update -append -f "ESRI Shapefile" two.shp one.shp -nln two one
The program exits with a windows error ModName: gdal_fw.dll
ModVer:1.3.1.0 Offset:005656d0
If anyone wants the log, I can send it direct.
Thanks - Alex
More information about the Gdal-dev
mailing list