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 – adding data to your map


Time to get back to coding. Now that we have the data from Flickr from the previous example, let's add it to our map. We'll create a Google Maps base layer and then a vector layer filled with the Flickr data on top of it.

  1. First, we need to make sure the flickr_data.kml file is in the same directory that we'll be creating our map in. Save the file in your server's document root folder, which may be something like (with Xampp on windows) c:/xampp/htdocs or on OSX (with Xammp, http://www.apachefriends.org/en/xampp-macosx.html) in /Applications/XAMPP, or on Linux: /var/www/. We'll refer to it as example_1.html.

  2. Now let's create the map. We won't be using a WMS layer this time—instead, we'll just be using a Google base map and place our vector layer on top of it. Make sure to first add the reference to the Google Maps API in the <head> section:

    <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
  3. Now, create and add a...

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