Re: WMS overlay alignment on Google Map baselayer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: WMS overlay alignment on Google Map baselayer

Arnd Wippermann
Hello,

I would think, OpenLayers does not currently support drawing WMS results
WRONG on top of Google Maps. With adding the vmap-Layer to google_map.html
it seems that the arcadia-layer lies on the right position.

Am I right, that Google Maps in OpenLayers always differ from the correct
SRS, because Google use a special projection (to avoid users from simple
joining their own data with google maps?) and therefor I have to modificate
my own data to show them with Google as underlieing map. That is my
experience with a WMS Point layer, from which I have made a KML-file
(EPSG:4326) to show the points in Google Map or Earth. I had to add an
offset to place the points at the right place.

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/pinguinale/


-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]] Im
Auftrag von Christopher Schmidt
Gesendet: Freitag, 18. August 2006 19:44
An: Ross Mongin
Cc: [hidden email]
Betreff: Re: [OpenLayers-Users] WMS overlay alignment on Google Map
baselayer

On Fri, Aug 18, 2006 at 12:14:40PM -0500, Ross Mongin wrote:

> Several posts have touched on the topic of Google Maps mix of Lat /Lon
> and Mercator at different zoom levels.
>
> http://mailman-viper.python-hosting.com/pipermail/users/2006-June/0000
> 29.html
>
> The Google Map / Geoserver WMS function works.  The javascript
> function adjusts the WMS request, setting the SRS to the correct
> projection as it moves to the lower zoom levels.
>
> http://www.mongin.net/maps/google_map1.html

That's not all that this does. The code in use here translates from
coordinates in Lat/Lon unprojected to mercator, meaning it 'skews' each tile
request in the CustomGetTileURL function. Because WMS supports non-square
pixels, the image looks right.

    var lULP = new GPoint(a.x*256,(a.y+1)*256);
    var lLRP = new GPoint((a.x+1)*256,a.y*256);
    var lUL = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);
    var lLR = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);

This is the code in question.

>
> However, the same WMS service called using the OpenLayers control
> shows the tile overlay incorrectly offset, even at the lower zoom
> levels when it is using lat/long ESPG 4326.

Google does not ever use EPSG:4326. The images at smaller zooms seem less
distored because distortion is as a result of geographic vertical skew, and
there is less geographic vertical distortion when there is less geographic
vertical distance to cover.

OpenLayers does not currently support drawing WMS results correctly on top
of Google Maps. Patches to add this functionality where appropriate are
welcome.

Regards,
--
Christopher Schmidt
Web Developer
_______________________________________________
Users mailing list
[hidden email]
http://mailman-viper.python-hosting.com/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://mailman-viper.python-hosting.com/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS overlay alignment on Google Map baselayer

Christopher Schmidt
On Sun, Aug 20, 2006 at 10:44:22AM +0200, Arnd Wippermann wrote:
> Hello,
>
> I would think, OpenLayers does not currently support drawing WMS results
> WRONG on top of Google Maps. With adding the vmap-Layer to google_map.html
> it seems that the arcadia-layer lies on the right position.

Wrong is one way of putting it ;) Differently is another. Google Maps
does use a different kind of projection -- the projection in question
does exist, there's nothing particularly 'wrong' with it, however, their
way of exposing it to the web is not in a way that makes sense in GIS
terms. Essentially, they take the whole world, project it into Mercator,
and then their API does all the math to convert from Lat/Lon to
Mercator, displaying the map correctly.

Google now exposes functionality to convert from their lat/lon to
Mercator projected coordinates in meters. It is possible to use this to
determine the bounding box for where a tile actually is geographically,
and in that sense, drawing the map in the right location. This is what
the custom tiling code which the original poster is using. However,
*this is additional code that OpenLayers does not have*. Again, this is
not an impossibility, but it is something that OpenLayers does not
currently do.

> Am I right, that Google Maps in OpenLayers always differ from the correct
> SRS, because Google use a special projection (to avoid users from simple
> joining their own data with google maps?) and therefor I have to modificate
> my own data to show them with Google as underlieing map.

This is only somewhat correct. Google Maps uses a *different* projection
-- but not a special one. It's just Mercator. However, it's not obvious
from their interface, which is designed for Humans, rather than GIS
professionals.

--
Christopher Schmidt
Web Developer
_______________________________________________
Users mailing list
[hidden email]
http://mailman-viper.python-hosting.com/listinfo/users