[Qgis-developer] QGIS Python AddMaplayer but with low resolution
dingnan
dingnan801 at 163.com
Tue Jan 17 02:20:53 PST 2017
Hello, I'm new to QGIS Python develop. I was trying to add raster layer (.asc
file) into QGIS. Below are my srcrips.
from qgis.PyQt.QtCore import *
import gdal
import os
filePath = "path/2017011003.asc"
style_layer = "path/StreamStyle.qml"
fileInfo = QFileInfo(filePath)
baseName = fileInfo.baseName()
rlayer = QgsRasterLayer(filePath, baseName)
if not rlayer.isValid():
print "Layer failed to load!"
crs = rlayer.crs()
crs.createFromId(4610,QgsCoordinateReferenceSystem.EpsgCrsId)
rlayer.setCrs(crs)
rlayer.loadNamedStyle(style_layer)
QgsMapLayerRegistry.instance().addMapLayer(rlayer)
I did add the raster layer into qgis, but the problem is that the layer
seems very dim... I also import the same raster image by just using the qgis
"Add Raster Layer" function which shows quite clear
Here is the comparison:
<http://osgeo-org.1560.x6.nabble.com/file/n5303695/%E6%A8%A1%E7%B3%8A.png>
<http://osgeo-org.1560.x6.nabble.com/file/n5303695/%E6%B8%85%E6%A5%9A.png>
Does anyone met same issue before? Thank you very much!
Best,
Nan
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-Python-AddMaplayer-but-with-low-resolution-tp5303695.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.
More information about the Qgis-developer
mailing list