[Qgis-user] Change Projection in Projection Properties from a Python PlugIn

bjsvwpfe Michael.Pfeiffer at bd.so.ch
Wed Oct 8 03:10:21 PDT 2008


Hi,

since Version 1.0.0 preview (r9452) I have the same problem again.

I can set the project settings with my PlugIn without any problems.
And now the last little problem is back again. I make the settings with the
following code:
    srs = QgsCoordinateReferenceSystem()
    srs.createFromEpsg(21781)
    self.canvas = self.iface.mapCanvas()
    self.canvas.setMapUnits(QGis.METERS)
    self.rect = self.canvas.extent()
    mapRender = self.canvas.mapRenderer()
    mapRender.setMapUnits(QGis.METERS)
    mapRender.setDestinationSrs(srs)
    mapRender.setProjectionsEnabled(1)
    mapRender.fullExtent()
    self.canvas.refresh()
   
QgsProject.instance().writeEntry("SpatialRefSys","/ProjectSRSProj4String",srs.proj4String())
    QgsProject.instance().writeEntry("Digitizing","/TopologicalEditing",1);
   
QgsProject.instance().writeEntry("Digitizing","/AvoidPolygonIntersections",1);
   
QgsProject.instance().writeEntry("SpatialRefSys","/ProjectionsEnabled",1);

In version 0.11.0 this worked fine for me.
But since Version 1.0.0 the problem is back again. All settings are set in
project settings but I have to go in the project settings press the OK
button and then it works.
Are there any changes in this part since Version 0.11.0?
Qgis throws the following Warnings when loading a layer

Warning: Throwing exception
/usr/local/src/sogis/qgis_src/trunk/src/core/qgscoordinatetransform.cpp502
Warning: Throwing exception
/usr/local/src/sogis/qgis_src/trunk/src/core/qgscoordinatetransform.cpp226
Warning: Throwing exception
/usr/local/src/sogis/qgis_src/trunk/src/core/qgscoordinatetransform.cpp246
Warning: Transform error caught in
/usr/local/src/sogis/qgis_src/trunk/src/core/qgsmaprenderer.cpp, line 545

Greets

Michael
-- 
View this message in context: http://www.nabble.com/AW%3A-Change-Projection-in-Projection-Properties-from-a-Python-PlugIn-tp17516111p19875965.html
Sent from the qgis-user mailing list archive at Nabble.com.




More information about the Qgis-user mailing list