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 the Yahoo! Maps Layer

Let's create a map with the Yahoo! Maps Layer class.

  1. In the <head> section, we need to reference the location of the Yahoo! Maps API. Add the following before the OpenLayers inclusion script tag:
    <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
  2. Let's set up some Yahoo! layer objects now. Like the Google Maps Layer, we specify the type of the layer we want by setting the type property. Let's create a hybrid layer. The type property for Yahoo! layers start with YAHOO_MAP_, followed by a three character code:
    var yahoo_hybrid = new OpenLayers.Layer.Yahoo(
      "Hybrid",
      {type: YAHOO_MAP_HYB, numZoomLevels: 24}
    );
  3. Now let's create a satellite layer type. The three character ...

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