1

Here is my current code:

#Loading of post-wrf(raster) files starts here
crs = 'USER:100000'
QSettings().setValue('/Projections/defaultBehaviour', 'useGlobal')
QSettings().setValue('/Projections/layerDefaultCrs', crs)
rLayer = QgsRasterLayer("/home/francis/QGIS/tiffout/test.tif", "")
if rLayer.isValid() is True:
    print("Layer {} loaded successfully".format(rLayer.name()))
else:
    print("Layer {} did not load successfully".format(rLayer.name()))
QgsMapLayerRegistry.instance().addMapLayers([rLayer])

#Loading of Shp file (vector) starts here
crs = 'EPSG:4326'
QSettings().setValue('/Projections/defaultBehaviour', 'useGlobal')
QSettings().setValue('/Projections/layerDefaultCrs', crs)
vLayer = QgsVectorLayer("/home/francis/QGIS/shpfile/PHL_adm1.shp", "Map", "ogr")
if vLayer.isValid() is True:
    print("Layer {} loaded successfully".format(vLayer.name()))
else:
    print("Layer {} did not load".format(vLayer.name()))
QgsMapLayerRegistry.instance().addMapLayers([vLayer])

my .shp file has the default coordinates of EPSG:4326 my raster file has a user defined coordinate and I can't save these two layers as one image.

I am new to using QGIS and Python.

The first screenshot is the sample output that I want to achieve with the correct alignment of the coordinates. (The layers were manually loaded in the QGIS UI)

The second screenshot of the User Defined Coordinate that QGIS provided. and my .gr2 data is an output of WRF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.