<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Sep 10, 2014 at 7:05 AM, Leyan <span dir="ltr"><<a href="mailto:ouyang.leyan.ml@hotmail.com" target="_blank">ouyang.leyan.ml@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/09/2014 05:36 AM, Mark Coletti wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
        layerCenter = layer.extent().center()<br>
<br>
        if layer.crs().geographicFlag() : # if already lat/long, do nothing<br>
            return layerCenter<br>
        else :<br>
            sourceCRC = layer.crs() # get the coordinate reference system being used<br>
            # 4326 is WGS 84<br>
            coordinateTransform = QgsCoordinateTransform(<u></u>sourceCRC.toWkt(), QgsCoordinateReferenceSystem(<u></u>4326).toWkt())<br>
            return coordinateTransform.transform(<u></u>layerCenter)<br>
<br>
</blockquote></span>
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.</blockquote><div><br></div><div>I'm aware that there exist myriad geographic coordinate systems.  However, I'm as yet aware of a QgsCoordinateTransform that will allow me to convert from a projected coordinate reference system to a "gee, I don't care, whatever geographic coordinate system."  I just referenced a popular geographic coordinate system because it was good enough for my purposes.<br><br>However, this may be a valid concern if this does become a snippet on the web site.  So, I'll ask again: how do I get this code added as a snippet to the web site since it's likely a common use case for plugin development?</div></div>
</div></div>