[Qgis-user] Iterators in QGIS

Claas Leiner claas.leiner at gkg-kassel.de
Tue Nov 13 06:38:54 PST 2018


Hi,

you can convert with ogr2ogr in a batch-file:



Windows:
Copy this code in a file called shp2gpkg.bat
---------------.....................................
@echo off
echo Write Shapes to Geopackage

set /p db="Name of the geopackage:  "

set /p pfa="Path to Shapes: "

set /p kbs="EPSG of SRS?    "

pushd "%pfa%"
for %%i in (*.shp) do (
ogr2ogr --config OGR_SQLITE_SYNCHRONOUS OFF  --config OGR_SQLITE_CACHE 
8192 -f "GPKG" -skipfailures -update -addfields -gt unlimited -nlt 
PROMOTE_TO_MULTI -a_srs EPSG:%kbs% %db%.gpkg %%i
)
------------------------------
and save shp2gpkg.bat
to C:\path_to__gis_installation\bin

then you can rund shp2gpkg.bat in the osge4wshell to convert a directory 
with shapefiles in as Geopackage.

-----------------------------------
--------------------------------------------
Linux:
Copy this code in a file called shp2gpkg.sh
---------------------------------------
#!/bin/bash
# shp2gpkg Shapes to Geopackge

read -p "Name of the geopackage and return:   " db
echo
echo
read -p "Path to the Shapes   " verzeich
echo
echo
read -p "EPSG of SRS?   " kbs
echo
echo
cd $verzeich

#shp
for shps in *.shp; do
ogr2ogr --config OGR_SQLITE_SYNCHRONOUS OFF  --config OGR_SQLITE_CACHE 
8192 -f "GPKG" -skipfailures -update -addfields -gt unlimited -nlt 
PROMOTE_TO_MULTI -a_srs EPSG:$kbs $db.gpkg $shps
done
-------------------------------------
and save shp2gpkg.sh
to /home/username/bin
then you can rund shp2gpkg.sh to convert a directory with shapefiles in 
a Geopackage.
----------------------------------

Claas



-- 
-----------------------------------------
GKG-Kassel - Dr.-Ing. Claas Leiner
QGIS-Support und mehr

Geodatenservice, Kartenwerkstatt &
GIS-Schule Kassel

Wilhelmshöher Allee 304 E
34131 Kassel
Tel. 0561/56013445
claas.leiner at gkg-kassel.de
----------------------------------------
http://www.gkg-kassel.de
----------------------------------------
Unterstützen Sie QGIS
QGIS-DE e.V. | http://qgis.de
QGIS Projekt | http://qgis.org/de/site/


More information about the Qgis-user mailing list