Thursday, 5 October 2017

qgis - Set CRS for Raster in QgsRasterLayer (pyqgis)


in a QGIS python plugin I get some code that writes a asc file, this is the header of the final file:


NCOLS  20 
NROWS 15
XLLCORNER 664400.000000

YLLCORNER 4749500.000000
CELLSIZE 100.000000
NODATA_VALUE -9999.0
NODATA_VALUE -9999.0

as you can see I get the X and Y corners of the file.


I wanted also to load the file in QGIS and obviously it asks me for the CRS.


What I am looking for, is to avoid this message and the related pop-up window while using QgsRasterLayer.


I've found this 2 old questions:


How can I specify the CRS of a raster layer in pyqgis?



and


How to get CRS of a raster layer in pyqgis?


but I cannot use them in order to solve my problem.


Someone has an idea?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...