On Thu, May 29, 2008 at 12:24 PM, bjsvwpfe <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> thanks for the answers. That was exactly what I'm searching for :jumping:
> So its possible for me to set the project settings now.
> But theres still a last little problem. I make the settings with the
> following code:
>
>    srs = QgsSpatialRefSys()
>    srs.createFromEpsg(21781)
>    self.canvas = self.iface.getMapCanvas()
>    self.canvas.setMapUnits(QGis.METERS)
>    self.rect = self.canvas.extent()
>    mapRender = self.canvas.mapRender()
>    mapRender.setDestinationSrs(srs)
>    mapRender.setProjectionsEnabled(1)
>    self.canvas.refresh()
>
> But the project settings are not applied to the map. You still have to press
> the apply Button in the Project Settings.
> How can I solve this last problem so that it is not necessary to press the
> apply button.

This should set the destination SRS to project settings:
QgsProject.instance().writeEntry("SpatialRefSys","/ProjectSRSProj4String",
proj4string)
where proj4string is proj4 definition of the SRS and can be obtained
from QgsSpatialRefSys

Hope that helps
Martin
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to