Re: [QGIS-Developer] Handling different GDAL versions in PyQGIS

2017-05-10 Thread Tom Chadwin
In case anyone is interested, I've got a version of this approach working
now:

https://github.com/tomchadwin/qgis2web/commit/6980a108bc8803c7907bb3ca7da90b1fdfc59a69

Needs testing, but works locally and under Travis.

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Handling-different-GDAL-versions-in-PyQGIS-tp5319952p5320041.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Handling different GDAL versions in PyQGIS

2017-05-09 Thread Tom Chadwin
Hello all

An issue I face is different users' different GDAL versions meaning making
Processing GDAL calls in a plugin difficult, as you have to get the
arguments right:

https://github.com/tomchadwin/qgis2web/blob/v2.17.0/utils.py#L314

I've got these different argument lists wrapped in try: blocks, but was
wondering if a different approach might be better. If I call, for example,
processing.runalg("gdalogr:warpreproject") without arguments from the
console, I get an error back:

Error: Wrong number of parameters
ALGORITHM: Warp (reproject)
INPUT 
SOURCE_SRS 
DEST_SRS 
NO_DATA 
TR 
METHOD 
RAST_EXT 
EXT_CRS 
RTYPE 
COMPRESS 
JPEGCOMPRESSION 
ZLEVEL 
PREDICTOR 
TILED 
BIGTIFF 
TFW 
EXTRA 
OUTPUT 


METHOD(Resampling method)
0 - near
1 - bilinear
2 - cubic
3 - cubicspline
4 - lanczos
RTYPE(Output raster type)
0 - Byte
1 - Int16
2 - UInt16
3 - UInt32
4 - Int32
5 - Float32
6 - Float64
COMPRESS(GeoTIFF options. Compression type:)
0 - NONE
1 - JPEG
2 - LZW
3 - PACKBITS
4 - DEFLATE
BIGTIFF(Control whether the created file is a BigTIFF or a classic TIFF)
0 - 
1 - YES
2 - NO
3 - IF_NEEDED
4 - IF_SAFER

Can I rely on getting this kind of output from all GDAL versions? If so, I
can try to figure out the best way to parse out the arguments it needs, and
supply them.

Should this work?

Thanks

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Handling-different-GDAL-versions-in-PyQGIS-tp5319952.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer