[Qgis-user] merge shapefiles into one

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Sun Apr 12 23:28:46 PDT 2020


Even if I love QGIS, sometimes there is a better tool for certain GIS 
jobs. In this case: *ogr2ogr*, which is a command-line tool that's 
included in the QGIS distribution.

Do the following (I assume you want to make a shiny new geopackage file 
instead of old fiddly shapefile):

  * Create a directory in which to save the geopackage. Let's call it :
    *c:\data*
  * Create a text file with the following content:


ogr2ogr -f GPKG c:\data\census.gpkg -nln census -nlt PROMOTE_TO_MULTI 
/vsizip//vsicurl/https://www2.census.gov/geo/tiger/TIGER2019/TRACT/tl_2019_01_tract.zip/tl_2019_01_tract.shp
FOR %%G IN (02,04,05,06) DO (
   ogr2ogr -f GPKG c:\data\census.gpkg -nln census -nlt PROMOTE_TO_MULTI 
-append -update 
/vsizip//vsicurl/https://www2.census.gov/geo/tiger/TIGER2019/TRACT/tl_2019_%%G_tract.zip/tl_2019_%%G_tract.shp
)

  * save it as: *c:\data\cc.cmd*
  * start program "OSGeo4W Shell" it's located in same program group as
    QGIS 3.12. It will start**a dos command shell.
  * in the command shell: type: *call **c:\data\cc.cmd*
  * Voila! the cmd file will create a geopackage c:\data\census.gpkg
    that contains  census tracts 01, 02, 04, 05, 06
  * You can extend the number of census tracts by extending the
    linepart: 02,04,05,06 with (example)
    02,04,05,06,08,09,10,11,12,13,15 etc.
  * This www page *https://www2.census.gov/geo/tiger/TIGER2019/TRACT/
    *has a list of all available files. The available numbers is between
    01 and 78
  * The file names and www addresses can off course be changed to other
    values.

Den 12-04-2020 kl. 20:07 skrev Mark Fogarty:
> hi. i'm new to the list and qgis, apologies if this has been asked. we're
> working with the us census tract files available from census.gov here:
>
> https://www.census.gov/cgi-bin/geo/shapefiles/index.php?year=2019&layergroup
> =Census+Tracts
>
> they are published as 54 separate zip files, one per state. we would like to
> combine them into a single dataset. i found a lot of pages on the web that
> suggest using qgis for that purpose. they all start with
>
> Click on the Vector menu, Data Management tools, Merge Shapefiles to
> One...
>
> i just installed qgis 3.12.1, but my vector / data management tools menu
> doesn't have that option. has that tool been removed, or is there a plugin i
> need to install or maybe a different version?
>
> is that data already available in a combined format from somewhere, or is
> there a better way to do this?
>
> thanks
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Med venlig hilsen / Kind regards

Bo Victor Thomsen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200413/bbbff985/attachment.html>


More information about the Qgis-user mailing list