[OpenLayers-Users] WMS overlay alignment on Google Map base layer
Christopher Schmidt
crschmidt at crschmidt.net
Fri Aug 18 12:44:27 CDT 2006
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/000029.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
More information about the Users
mailing list