O'Reilly logo

OpenLayers 2.10 by Erik Hazzard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for Action – using Spherical Mercator

Let's set up a map using Spherical Mercator with a Yahoo! Maps Layer. When using the Google Maps Layer (V3), the sphericalMercator property is set to true automatically, so you do not need to do anything extra. However, explicitly specifying it is a good idea when working with other layers that are not in the Spherical Mercator projection.

  1. Since we'll use the Virtual Earth layer type, we need to make sure to include the Microsoft Mapping API:
    <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us"></script>
  2. The first step is to specify the maxExtent, maxResolution, units, and projection properties when creating our map object. If you'll remember from the previous chapter, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required