[Qgis-developer] How to avoid message: "CRS was undefined" ?

Luigi Pirelli luipir at gmail.com
Mon Nov 3 04:26:12 PST 2014


Hi

I've a third party plugin with a gdal virtual layer that is shown in QGIS.
The virtual layer is build with gdalbuildvrt and all images belong to
the same CRS

I know the CRS of the current project and the CRS of the images
composing the virtual layer... that are wms tiles, saved as png and
loosing CRS information.

when importing the layer appear the message:

CRS was undefined: defaulting to project.. and so on

this because during instanciacion of QgsRasterLayer(vrtpath,
"myraster), somewere is emitted the customCrsValidate(..) event that
try to check custom CRS.

I need to set CRS to avoid this messages. I've two way:
1) set gdalbuildvrt the parameter -a_srs to force srs, but it is
available only with gdal >= 1.10, and I'm loking for a generic vay to
solve
2) instanciate rl=QgsRasterLayer() and then set crs... but I can't
find a way to set path. neither setting QgsDataSourceURI

there's a solution that I'm missing?

regards Luigi Pirelli


More information about the Qgis-developer mailing list