[QGIS-Developer] Switch Layer CRS
Hauer Lukas
lukas.hauer at josephinum.at
Mon Aug 13 07:16:51 PDT 2018
Hi!
I want to load three layers into qgis (2.18) via python.
1 Vector Layer (boundary of my farm / fields)
2 Raster Layer ( band4 and band8 from sentinel satellite)
Additionally I want to switch them to the same crs (4326). But if I do this, the field boundaries are not visible as overlay on the raster layers...
I need to zoom out (quite a lot) and my boundaries are somewhere else in qgis.
Some a hint for me?
Here my example code..
import processing
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.analysis import *
fullPathFeldgrenzen = "Path/to/fields.shp"
fullPathBand4 = "Path/to/Band4/B04.jp2"
fullPathBand8 = "Path/to/Band8/B08.jp2"
fieldBoundary = iface.addVectorLayer(fullPathFeldgrenzen, 'fieldBoundary', 'ogr')
tmp = iface.activeLayer()
crs = tmp.crs()
crs.createFromId(4326)
tmp.setCrs(crs)
band4 = iface.addRasterLayer(fullPathBand4, 'band4')
tmp = iface.activeLayer()
crs = tmp.crs()
crs.createFromId(4326)
tmp.setCrs(crs)
band8 = iface.addRasterLayer(fullPathBand8, 'band8')
tmp = iface.activeLayer()
crs = tmp.crs()
crs.createFromId(4326)
tmp.setCrs(crs)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180813/60a58be7/attachment.html>
More information about the QGIS-Developer
mailing list