[gdal-dev] Combining shape files

Rainer M Krug r.m.krug at gmail.com
Fri Oct 3 09:56:29 EDT 2008


Hi

I have 6 shape files, named
region_SPP_1__Acacia_cyclops.shp to region_SPP_6__Acacia_cyclops.shp
which I would like to combinr into a single shape file, called
Acacia_cyclops.shp

For this I wrote the following script:

#!/bin/bash
SP="Acacia_cyclops"
ogr2ogr -f \"ESRI Shapefile\" "./comb/"$SP".shp" "./region_SPP_1__"$SP".shp"

ogr2ogr -update -append -f \"ESRI Shapefile\" "./comb/"$SP".shp"
"./region_SPP_2__"$SP".shp"
ogr2ogr -update -append -f \"ESRI Shapefile\" "./comb/"$SP".shp"
"./region_SPP_3__"$SP".shp"
ogr2ogr -update -append -f \"ESRI Shapefile\" "./comb/"$SP".shp"
"./region_SPP_4__"$SP".shp"
ogr2ogr -update -append -f \"ESRI Shapefile\" "./comb/"$SP".shp"
"./region_SPP_5__"$SP".shp"
ogr2ogr -update -append -f \"ESRI Shapefile\" "./comb/"$SP".shp"
"./region_SPP_6__"$SP".shp"

but even at line 3 I have problems:

if I do the following

> SP="Acacia_cyclops"
> ogr2ogr -f \"ESRI Shapefile\" "./comb/"$SP".shp" "./region_SPP_1__"$SP".shp"

I get the error message: "Unable to open datasource
`./comb/Acacia_cyclops.shp' with the following drivers."

but when I say
> echo ogr2ogr -f \"ESRI Shapefile\" "./comb/"$SP".shp" "./region_SPP_1__"$SP".shp"

and paste the output into the commandline, it works.

But with the remaining ogr2ogr, I have less luck: all result in the
same error message "Unable to open datasource
`./comb/Acacia_cyclops.shp' with the following drivers."

Any help appreciated,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa

""
-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa


More information about the gdal-dev mailing list