[Qgis-developer] Trasform QgsVectorLayer proj4 to another

Richard Duivenvoorde rdmailings at duif.net
Wed Dec 14 07:06:00 EST 2011


On 2011-12-14 12:59, francescoboccacci at libero.it wrote:
> Hi to all,
> i have a question for you. I have 2 vector layer that have two different 
> spatial references. I'd like to tranform(convert) one of these in the same 
> coordinate system.
> Like that:
> 
>  crsStart = QgsCoordinateReferenceSystem()
>  crsStart.createFromProj4(layerA.crs().toProj4())
>  crsDest = QgsCoordinateReferenceSystem()  
>  crsDest.createFromProj4(layerB.crs().toProj4())
>    
>   if crsStart != crsDest:
>   
>                     layerA = QgsCoordinateTransform(crsStart,crsDest).
> transformLayerAtoLayerB

Hi F,

Have a look here:

http://www.qgis.org/pyqgis-cookbook/index.html

specially here:

http://www.qgis.org/pyqgis-cookbook/crs.html#coordinate-reference-systems

Hope this helps...

Regards,

Richard


More information about the Qgis-developer mailing list