Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for Action – using Goole Maps V3 (standard way)


Let's create a map using V3 of the Google Maps API. We've already done this in Chapter 3, so you should be somewhat familiar with it. This is the standard way to use the Google Maps Layer, and you should use this method unless you specifically need a layer type in V2 that V3 does not yet support.

Note

With versions of OpenLayers prior to 2.10, accessing Google Maps V3 may not work.

  1. Version 3 of the Google Maps API does not require an API key. However, you still must include the following in your <head> section, so OpenLayers knows where to look for the Google Maps API library. We'll be asking the map's API and specify that we want v3.2 of the Google Maps API (you can leave the &v=3.2 parameter if you'd like to let Google Maps provide the latest version for you automatically). Add this before your OpenLayers inclusion script:

    <script src="http://maps.google.com/maps/api/js?sensor=false&v=3.2"></script>
  2. Let's start by...