[OpenLayers-Users] BING and OpenLayers

Roger André randre at gmail.com
Tue Mar 23 17:47:45 EDT 2010


Hate to report this, but setting restrictedExtent does not resolve the
problem.  While it seems to prevent the WMS layer from being slid off
the BING basemap permanently, the layers still move asynchronously
when the map is panned.  This means that after I am done panning and
let go of the map, I see continued, jerky movement of the layers in
the map interface.

Here's the revised code, with sphericalMercator set to true in the
BING layer instantiation, and restrictedExtent set in the map option.

If you have any additional ideas, I'd be happy to try them.  Otherwise
I'll reopen the ticket.

Thanks.
--

<html>
<head>
  <title>OpenLayers Example</title>
    <script src='http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us'></script>
    <script src="http://randre-laptop/OpenLayers-2.8/OpenLayers.js"></script>
    </head>
    <body>
      <div style="width:80%; height:80%" id="map"></div>
      <script defer='defer' type='text/javascript'>

  // Code goes here
  var map
  var proj_wgs84 = new OpenLayers.Projection("EPSG:4326");
  var seattle = new OpenLayers.LonLat(-122.3326, 47.5912);

  var options = {
      projection: new OpenLayers.Projection("EPSG:900913"),
      units: "m",
      maxResolution: 156543.0339,
      maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
      restrictedExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34, 20037508.34, 20037508.34)
      };

  map = new OpenLayers.Map('map', options);

  // create Virtual Earth base layer
  var vemap = new OpenLayers.Layer.VirtualEarth("Virtual Earth",
      { type: VEMapStyle.Aerial,
        sphericalMercator: true,
        numZoomLevels: 21,
        maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
      });


  // create WMS layer
  var zones = new OpenLayers.Layer.WMS(
      "Zones",
      "http://randre-laptop/cgi-bin/mapserv?",
      {map: '/var/www/mapfiles/mt_vernon/zones.map',
       layers: ['zones'],
       format: 'image/png',
       transparent: "true"},
      {'displayInLayerSwitcher': true,
       'isBaseLayer': false,
       'gutter': 256  }
  );

  map.addLayers([vemap, zones]);
  map.setCenter(seattle.transform(proj_wgs84, map.getProjectionObject()), 8);

      </script>
    </body>
</html>

On Tue, Mar 23, 2010 at 8:57 AM, Roger André <randre at gmail.com> wrote:
> Thanks!  Appreciate the tip.
>
> Is this documented somewhere?
> --
>
> On Tue, Mar 23, 2010 at 1:33 AM, Eric Lemoine
> <eric.lemoine at camptocamp.com> wrote:
>> On Sun, Mar 21, 2010 at 7:47 PM, Roger André <randre at gmail.com> wrote:
>>> Ok, I think I'll take the next step of fining a bug now.
>>
>> Hi
>>
>> You need
>>
>> restrictedExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
>> 20037508.34, 20037508.34)
>>
>> in the map options, so the WMS layer is restricted to the same extent
>> as the bing layer.
>>
>>
>> I closed the ticket as invalid.
>>
>> Thanks,
>>
>> --
>> Eric Lemoine
>>
>> Camptocamp France SAS
>> Savoie Technolac, BP 352
>> 73377 Le Bourget du Lac, Cedex
>>
>> Tel : 00 33 4 79 44 44 96
>> Mail : eric.lemoine at camptocamp.com
>> http://www.camptocamp.com
>>
>



More information about the Users mailing list