Re: [Qgis-user] Iterators in QGIS

2018-11-13 Thread Claas Leiner

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.lei...@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/
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Iterators in QGIS

2018-11-13 Thread Nicolas Cadieux
Hi,

I use python and not the modeler but I believe the model, once finished can be 
run in batch mode like the other processing algorithms.  Others will confirm.  
Unless there is very specific manipulations, You should find org2org in 
processing and  used in batch mode directly. 

It can also be used in the command line and iterator can be done there if you 
use dos iterators. 
https://www.gdal.org/ogr2ogr.html

If not I think the gdal plugin in Qgis 2.18 has a option (for many algorithms ) 
to take all files from one directly and to export them to another. I know they 
have this for gdal translate so they probably have it for OGR2OGR.  This uses a 
true iterator so you only have to set things once.  You can run two version of 
Qgis if you use the OSGeo4w installer.  

Nicolas

> Le 13 nov. 2018 à 02:56, Alejandro Chamizo de Castro  a 
> écrit :
> 
> 
> Dear colleagues,
> 
> I'm trying to make a graphical model in QGIS 3.4 to export several shp to a 
> geopackage. I'd like to use an iterator in the graphical modeler, because I'm 
> not very good with python.
> 
> Is possible to use iterators in graphical model in QGIS like other GIS sw 
> does?
> 
> 
> Thanks a lot
> 
> 
> 
> -- 
> Alejandro Chamizo de Castro
> +34 653681823
> www.gisland.es
> 
>   Remitente notificado con 
> Mailtrack 13/11/18 8:52:41
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Iterators in QGIS

2018-11-12 Thread Alejandro Chamizo de Castro
Dear colleagues,

I'm trying to make a graphical model in QGIS 3.4 to export several shp to a
geopackage. I'd like to use an iterator in the graphical modeler, because
I'm not very good with python.

Is possible to use iterators in graphical model in QGIS like other GIS sw
does?


Thanks a lot



-- 
Alejandro Chamizo de Castro
+34 653681823
www.gisland.es

[image: Mailtrack]

Remitente
notificado con
Mailtrack

13/11/18
8:52:41
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user