[Qgis-user] Merging multiple shapefiles - why doesn't it work?
Alex Mandel
tech_dev at wildintellect.com
Tue Nov 26 01:10:02 PST 2013
On 11/25/2013 07:24 AM, BigBaka wrote:
> Hi, I have for a particular province in my country of question I have
> multiple separate folders for each segment of the province and I'm trying to
> get all the segments combined into one larger shapefile for each unit (eg
> rivers). I've been looking around forums to try and do this seemingly simple
> task, but cannot find a solution that seems to work.Trying to use the merge
> shapefiles in Vector-> Data Management Tools doesn't seem to be a great
> option because it seems that you can only merge 2 files at a time, which is
> not particularly practical with 20 odd files. So I looked around and found a
> plugin called mmqgis which has a Merge Layers option which seems to offer a
> way to highlight certain layers in the TOC and spit out an output into a new
> shapefile. Everything seemed to work when I tried this but finally, I
> realised that not all the layers had been copied into the new shapefile. In
> fact it seems that only one or two layers will be combined at any one time.
> Lastly I followed a suggestion here
> <http://osgeo-org.1560.x6.nabble.com/Merging-3-different-Shapefiles-tt4138254.html#a4138257>
> to copy and paste the attribute tables from each different shapefile into a
> new shapefile. This seemed to work until I saved the new shapefile, and all
> the values in the attribute table turned to "NULL". I have exactly the same
> problem running Windows 7 (QGIS 1.8) and Ubuntu 12.04 (QGIS 2.0).Any
> suggestions welcome.ThanksBigBaka
>
>
Depends on if you want to learn to script a loop. You can definitely use
ogr2ogr on the command line with the append option. You'd need to write
a short script to loop over all shp files in your directory adding them
one at time. Or do something similar by importing all of the files into
a spatialite or postgis database (both could also be scripted).
Enjoy,
Alex
More information about the Qgis-user
mailing list