Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenLayers 2.10 Beginner's Guide
  • Table Of Contents Toc
  • Feedback & Rating feedback
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
close
close
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)

Overview of this book

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

Time for Action – creating a Google Map layer with V2 (Deprecated)


Let's create a map with V2 of the Google Maps API. This is not the proper way to use the Google Maps layer, but I am including it because you are likely to come across a code that uses V2 of the API. Google Maps V2 also provides a few different layer types (like a moon layer) that V3 does not provide at the time of writing.

  1. V2 of the Google Maps API requires you to register an API key, so grab one (for free) at http://code.google.com/apis/maps/signup.html. If you don't have a domain name, use http://localhost.

  2. In the <head> section, before the OpenLayers script tag, include the following. Replace YOUR_KEY with the key generated from Step 1:

    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=YOUR_KEY'></script>
  3. Let's create some layers now. The format of the type attribute is slightly different with V2. We'll go over the possible layer type values right after this example. First, let's...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY