[OpenLayers-Users] Google-like tiles in an example

Coryat coryat at gmail.com
Wed Mar 5 11:54:33 EST 2008



euzuro wrote:
> 
> So it turns out all this was already set up. For anyone looking for
> help setting up google tile site, see:
> 
> http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#HowdoIloadtilesIhavethatIgeneratedforGoogleMapsinOpenLayers
> 
> thanks chris for pointing that out.
> erik
> 

There are two key pieces of information missing from this FAQ entry which
took me a while to figure out:

In the map options:

 displayProjection: new OpenLayers.Projection("EPSG:4326"), // use WGS84
coordinates 

To use WGS84 coordinates they have to be transformed from the native system
(meters or what?)

 var lonLat = new OpenLayers.LonLat(-100, 40) ;
 lonLat.transform(map.displayProjection,map.getProjectionObject());
 map.setCenter(lonLat, 5);

Anyone who is coming from the Google Maps API to OpenLayers will want to
specifically know how to handle this situation. In GMAPI, everything is
automatically WGS84 in Spherical Mercator. These two bits would move things
along nicely.


-----
John Coryat, USNaviguide LLC

http://maps.huge.info
http://www.usnaviguide.com
-- 
View this message in context: http://www.nabble.com/Google-like-tiles-in-an-example-tp15840099p15854914.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list