[Qgis-developer] Re: Openlayers plugin and Virtual Earth (i.e.Bing Maps)

Pirmin Kalberer pi_ml at sourcepole.com
Fri Dec 3 04:00:33 EST 2010


Noli,
Test the HTML directly in a browser first. It does not show the expected extent 
in my browsers.
Pirmin

Am Freitag, 3. Dezember 2010, um 09.49:51 schrieb Noli Sicad:
> Hi Pirmin,
> 
> Sorry about the wrong code. Here the right bing layer.
> 
> Noli
> 
> ~~~~~~~~~~~~~~~
> <html xmlns="http://www.w3.org/1999/xhtml">
>   <head>
>     <title>Bing Shaded Map</title>
>     <style type="text/css">
>         body {
>             margin: 0;
>         }
>         #map {
>             width: 100%;
>             height: 100%;
>         }
>     </style>
>     <script
> src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=
> en-us"></script> <script src="OpenLayers.js"></script>
>     <script type="text/javascript">
>         var map;
> 
>         function init() {
>             map = new OpenLayers.Map('map', {
>                 theme: null,
>                 controls: [],
>                 projection: new OpenLayers.Projection("EPSG:900913"),
> 		displayProjection: new OpenLayers.Projection("EPSG:4326"),
>                 units: "m",
>                 maxResolution: 156543.0339,
>                 maxExtent: new OpenLayers.Bounds(-20037508.34,
> -20037508.34, 20037508.34, 20037508.34)
>             });
> 	    var shaded = new OpenLayers.Layer.VirtualEarth("Shaded", {
> 	                type: VEMapStyle.Shaded, numZoomLevels:
> 19,'sphericalMercator': true}
> 		);
> 	    map.addLayer(shaded);
>             map.getLayersBy('name','Shaded')[0].mapObject.Resize(500,500);
>             map.setCenter(new OpenLayers.LonLat(0, 0), 2);
>         }
> 
>     </script>
>   </head>
>   <body onload="init()">
>     <div id="map" class="bigmap" style="width: 800px; height:
> 600px;"></div> </body>
> </html>
> 
> On 12/3/10, Noli Sicad <nsicad at gmail.com> wrote:
> > Hi Pirmin,
> > 
> >> I would try to omit the displayProjection in OpenLayers (as in
> >> http://openlayers.org/dev/examples/bing.html) and change the QGIS
> >> reprojection
> >> to EPSG:54004  or whatever Bing's projection is.
> > 
> > I deleted displayProjectiion and tried these codes.
> > 
> > a) projection: new OpenLayers.Projection("EPSG:3857"),
> > b) projection: new OpenLayers.Projection("EPSG:54004"),
> > 
> > No avail. It did not change the alignment. It still off.
> > 
> > There is example Spherical Mercator Layers, for overlaying Google,
> > Yahoo, Microsoft, and other layers with WMS and TMS tiles (below). But
> > the problem with this example, you can see the layers. It just one at
> > the time.
> > 
> > http://openlayers.org/dev/examples/spherical-mercator.html
> > 
> > I think this is the same problem with google - bing map  and wms - bing
> > 
> > http://www.mail-archive.com/openlayers-dev@lists.osgeo.org/msg00047.html
> > 
> > According to this post below, Bing uses EPSG:102113 same as EPSG:900913
> > 
> > http://geoux.wordpress.com/2009/07/31/bing-oh/
> > 
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > Another thing, I tried to digitise /trace bing map. The new shapefile
> > layer is funny. It will not follow the bing map projection, zooming
> > and unzooming the newly created shapefile layer is off from the object
> > being traced. While doing this in google map, it is working correctly.
> > 
> > Noli


-- 
Pirmin Kalberer
Sourcepole  -  Linux & Open Source Solutions
http://www.sourcepole.com


More information about the Qgis-developer mailing list