[Qgis-developer] Getting WGS84 for a point

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun May 2 15:01:36 EDT 2010


I'm  trying to sort out the right way of getting from a click on the
map canvas to WGS84 coords for passing to web services that use WGS84
- this is for my clickfu plugin.

Currently the code looks to see if there's a CRS for the project, and
converts the click to WGS84 using a transform based on the project
CRS.

However if I start a new project and load in a shapefile with, say, an
OSGB CRS set in it's .prj file, my code doesn't do anything special,
doesn't find a project CRS, and so sends google maps a query with
lat=4453500 and lng=6755300.

Perhaps my code should check if the current layer has a CRS and
transform to WGS84 based on that instead of testing for a project CRS?
Or should it do both? Which first? Or am I doing something wrong here?

Thx

Barry

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman


More information about the Qgis-developer mailing list