[OpenLayers-Users] Bing tiles and TMS layer tiles don't line up! Projection problem?

AlexR alexrushforth at hotmail.com
Tue Jun 7 06:14:02 EDT 2011


I'm attempting to offer a Bing maps baselayer with a custom TMS tile layer
overlay in my application. However The two layers don't line up! It appears
as if the Bing tiles are being fetched from the wrong zoom level (continents
are around double the size on the bing tiles compared to the overlay), but
this could also be a problem with how i've set up the map options for
layers, perhaps?

Here are my layer settings:


            var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: 'm',
                numZoomLevels: 8,
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508.34)
            };

            map = new OpenLayers.Map('mymap', options);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            var vemap = new OpenLayers.Layer.VirtualEarth("Virtual Earth", { 
                type: VEMapStyle.Hybrid,
                sphericalMercator: true,
                numZoomLevels: 8,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508.34)
            });

            layer = new OpenLayers.Layer.TMS("Basemap", "my_url",
                    { 'transparent': 'true', 'type': 'png', 'getURL':
get_tile_url, 'isBaseLayer': true }
		        );

             map.addLayers([layer, vemap]);

            map.setCenter(new OpenLayers.LonLat(lon, lat).transform(
                new OpenLayers.Projection("EPSG:4326"),
                map.getProjectionObject()
                ), zoom);
 

Can anyone see any reason why the tiles are not aligning correctly? Many
thanks! Alex

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Bing-tiles-and-TMS-layer-tiles-don-t-line-up-Projection-problem-tp6448887p6448887.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list