[OpenLayers-Users] Re projecting Google

Jon Britton man_kills_everything at hotmail.com
Mon Jan 21 04:14:22 EST 2008


Hi,
I'm trying to call the following code but get "OpenLayers.Projection is not
a constructor" from Firefox FireBug.

var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left,
bounds.bottom));
var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right,
bounds.top));
var lltrans = ll.clone();
var urtrans = ur.clone();
lltrans.transform(new OpenLayers.Projection("EPSG:900913"),new
OpenLayers.Projection("EPSG:27700"));
urtrans.transform(new OpenLayers.Projection("EPSG:900913"),new
OpenLayers.Projection("EPSG:27700"));

Surely OpenLayers.Projection IS a constructor?

Thanks,
Jon



Thomas Wood-4 wrote:
> 
>> Message: 9
>> Date: Wed, 9 Jan 2008 07:25:26 -0500
>> From: Christopher Schmidt <crschmidt at metacarta.com>
>> Subject: Re: [OpenLayers-Users] Re projecting Google
>> To: Jon Britton <man_kills_everything at hotmail.com>
>> Cc: users at openlayers.org
>> Message-ID: <20080109122526.GA4446 at alta.metacarta.com>
>> Content-Type: text/plain; charset=us-ascii
>>
>> On Wed, Jan 09, 2008 at 03:27:11AM -0800, Jon Britton wrote:
>> >
>> > Hi,
>> > I've got data in EPSG:27700 (British National Grid) and want to overlay
>> it
>> > on Google data. However, I want to reproject the Google data into
>> EPSG:27700
>> > and not the other way around. Can this be done?
>>
>> Project the google *data*? Google ain't yours, man: You can't do
>> anything fun with it (and definitely not reproject it!)
>>
>> > Alternatively, can OpenLayers convert from Google coordinates to
>> EPSG:27700
>> > coordinates? All I need is to be able to get the 27700 coordinates of
>> the
>> > current view.
>>
>> It is possible, using the trunk versio of OpenLayers, to convert from
>> Google coordinates to lon/lat. It is possible, using proj4js or perhaps
>> a custom transformation function, to convert from lon/lat to EPSG:27700.
>> I know of at least one person who has done it -- I'll try and remember
>> who and get him to post.
>>
>> Regards,
>> --
>> Christopher Schmidt
>> MetaCarta
> 
> I have written a class that plugs into the existing reprojection code.
> 
> As you mention reprojecting coords here's a quick demo of usage:
> ll = new OpenLayers.LonLat(-11554.3527964992,6686865.32722571);
> ll.transform((new OpenLayers.Projection("EPSG:900913"), new
> OpenLayers.Projection("EPSG:27700"));
> 
> This will convert Google coords (Google sphericalMercator) to OSGB.
> The class supports OSGB to and from Google (ESPG:900913), and OSGB to
> and from WGS84 lat/long (ESPG:4326).
> 
> Some of the math functions are poorly documented (it was a quick
> convert from an already-existing conversion class)
> 
> Finally, the code is here:
> http://ge.pythonmoo.co.uk/maps/OpenLayers.Projection.OrdnanceSurvey.js
> Please don't hotlink it.
> 
> -- 
> Regards,
> Thomas Wood
> (Edgemaster)
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/Reprojecting-Google-tp14709777p14993599.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list