[OpenLayers-Users] Questions: Projections, Google, Yahoo, etc

Christopher Schmidt crschmidt at metacarta.com
Mon Feb 19 11:38:41 EST 2007


On Mon, Feb 19, 2007 at 11:23:15AM -0500, Stephen Woodbridge wrote:
> Hi all,
> 
> I am trying to research the various commercial layer providers and I 
> think Google, Google Earth, and Yahoo Virtual all claim to use Mercator 
> projections.

Yes.

> Are they all using the same projection?

Yep. It seems that all the commercial providers use the same projection.

> Does anyone have a list of the projects that the various commercial 
> layer providers are using? In terms of Proj4 definitions?

Nope. I thought for a long time that the proj4 string was just 
"+proj=merc"  -- there is a large body of literature on the web which
essentially says this is the case (all the other values are defaults).
However, when using that projection, I've had problems with offsets from
Google Maps that I don't understand. 

> In OpenLayers, if I want to use one of these commercial layers and 
> overlay it with a WMS layer, how good it the registration of the images?
> Which is best/worst or are they all the same?

They are all the same. They all work in the same way: decide where to
put the tiles, put pins down on the geographic locations of the corner
of the tiles, and ask the base layer where those pins are, then draw the
tiles.

> I have read that with Google Layers there is some kind of stretching of 
> the tiles or something to get them to align. 

That's actually true for *all* layers -- even WMS ones -- but it should
have no affect in any case other than Google. Essentially, this results
in a linear stretch of the content vertically. For tile areas that cover
less than a few degrees, this is fine, because the Mercator projection
is close enough to linear that it isn't a problem. For areas where a
single tile covers from 0->90 degrees north, this becomes obviously
wrong: zoom out on http://openlayers.org/dev/examples/google.html for an
example.

Some of this can be accomodated for by using smaller tiles (vertically),
but at some point, there will need to be reprojection support in your
setup -- most likely in OpenLayers -- and that support doesn't exist in
code that's available today.

> Is there are write up of 
> what is getting stretched and why? 

Google's API interacts in decimal degrees, even though the underlying
data is projected into meters. Because of this, as you move throughout
the map, the number of pixels in one geographic unit (degree) change. 

In the case of a mercator projected WMS layer, the units are in meters.
In that projection, meters are linear: if you move north one pixel, you
will always be moving north the same number of meters. 

Because of this, combined with the fact that  OpenLayers doesn't support
reprojection, it is neccesary to take a tile and ask the base layer
where that tile is geographically. 

> and how this might impact overlaying 
> other data in an application build around OL.

It shouldn't. The goal is to make the overlaying of data be transparent
to the user. This reprojection defaults to on for layers which support
it -- WMS -- and has few ill effects when you have a server that accepts
arbitrary bounding boxes.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list