[OpenLayers-Users] Google-like tiles in an example
Christopher Schmidt
crschmidt at metacarta.com
Wed Mar 5 12:13:32 EST 2008
On Wed, Mar 05, 2008 at 08:54:33AM -0800, Coryat wrote:
>
>
> 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?)
Transformed *from* WGS84 long/lat *to* mercator-projected meters.
> 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.
Would you be willing to edit the text of
http://trac.openlayers.org/wiki/UsingCustomTiles to explain this? Note
that these things are all new since I wrote that wiki page: at the time,
there *was* no such thing as displayProjection :) (I added it for OSM
users, but the same kind of things apply to Google Maps users as well.)
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list