[Qgis-user] Search through folders and combine SHP files
chris hermansen
clhermansen at gmail.com
Thu May 9 17:18:44 PDT 2024
Tony and list,
On Thu, May 9, 2024, 16:06 Tony Shepherd (FarmMaps NZ) via QGIS-User <
qgis-user at lists.osgeo.org> wrote:
> Hi
>
>
>
> I have loads, literally thousands, of SHP, GPKG, TAB files located in
> loads of different folders and sub-folders.
>
>
>
> Is there a plugin that will trawl through a set of folders, copy say just
> the polygons from each file into a new file, and populate a field with say
> the filename and folder the polygon(s) came from?
>
>
>
> Essentially combining a heap of files into one with some metadata about
> where the data came from?
>
>
>
> Why? I have files from clients dating back about 20 years. Clients sell
> properties. Properties get subdivided. New clients come and see us, and
> often we don’t realise we have GIS info on file for that property from many
> years ago, usually under a different name. It would be handy to see a
> polygon on the screen and easily go back to some old GIS data.
>
>
>
> Maybe I am missing an easy tool to do this, but I can’t see anything
> obvious.
>
Have you considered creating a PostGIS database, where each file imported
is in a table named for the source? You could also create a companion
metadata table.
You would script something like this with shp2pgsql
https://postgis.net/docs/using_postgis_dbmanagement.html
To load the spatial data and likely the psql client with CREATE TABLE and
INSERT statements in an SQL script.
If you're on Linux or OS/X you would use the find command to create the
shell script. Probably something similar in Power Shell if you're on
Windows.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240509/690c6dfd/attachment.htm>
More information about the QGIS-User
mailing list