On 09/09/2014 05:36 AM, Mark Coletti wrote:
If you want to be rigorous, there are different lat/long coordinate system, it is not only WGS84. The difference will be small of course, but I do not see the point of specifically testing for this case while it does not add anything.layerCenter = layer.extent().center()if layer.crs().geographicFlag() : # if already lat/long, do nothingreturn layerCenter else :sourceCRC = layer.crs() # get the coordinate reference system being used# 4326 is WGS 84coordinateTransform = QgsCoordinateTransform(sourceCRC.toWkt(), QgsCoordinateReferenceSystem(4326).toWkt())return coordinateTransform.transform(layerCenter)
Regards, Leyan _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
