[OpenLayers-Users] Cloudmade transform

Christopher Schmidt crschmidt at metacarta.com
Tue Sep 29 07:34:01 EDT 2009


On Tue, Sep 29, 2009 at 02:27:35AM -0700, Mulone wrote:
> 
> Hi guys,
> I'm using OpenLayers with Cloudmade and I don't quite get the transform
> thing.
> In this bit of code I want to get the mouse click on the interface and
> convert it to latlon, but I get very big numbers. What am I doing wrong
> here?

You're translating backwards. You want to go *from* the map, *to* degrees.

var lonlat = point.transform(map.getProjectionObject(), epsg4326);

>              trigger: function(e) {
> 		var point = map.getLonLatFromPixel(e.xy);
> 		var lonlat = point.transform(epsg4326, map.getProjectionObject());
>                 alert("You clicked near " + lonlat.lat + " N, " + lonlat.lon
> + " E");
>              }
> 
> 
> Thanks for any hint!
> Mulone
> -- 
> View this message in context: http://n2.nabble.com/Cloudmade-transform-tp3734908p3734908.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list