Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenLayers 2.10 Beginner's Guide

You're reading from   OpenLayers 2.10 Beginner's Guide Create, optimize, and deploy stunning cross-browser web maps with the OpenLayers JavaScript web mapping library

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher
ISBN-13 9781849514125
Length 372 pages
Edition Edition
Languages
Arrow right icon
Toc

Table of Contents (18) Chapters Close

OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with OpenLayers FREE CHAPTER 2. Squashing Bugs With Firebug 3. The 'Layers' in OpenLayers 4. Wrapping Our Heads Around Projections 5. Interacting with Third Party APIs 6. Taking Control of Controls 7. Styling Controls 8. Charting the Map Class 9. Using Vector Layers 10. Vector Layer Style Guide 11. Making Web Map Apps Index

Relation to Google / Yahoo! / and other mapping APIs


The Google, Yahoo!, Bing, and ESRI Mappings API allow you to connect with their map server backend. Their APIs also usually provide a client side interface (at least in the case of Google Maps).

The Google Maps API, for instance, is fairly powerful. You have the ability to add markers, plot routes, and use KML data (things you can also do in OpenLayers)—but the main drawback is that your mapping application relies totally on Google. The map client and map server are provided by a third party. This is not inherently a bad thing, and for many projects, Google Maps and the like are a good fit.

However, there are quite a few drawbacks.

  • You're not in control of the backend

  • You can't really customize the map server backend, and it can change at any time

  • There may be some commercial restrictions, or some costs involved

  • These other APIs also cannot provide you with anything near the amount of flexibility and customization that an open source mapping application framework (i.e., OpenLayers) offers

Layers in OpenLayers

So, what's with the Layer in OpenLayers? Well, OpenLayers allows you to have multiple different 'backend' servers that your map can use. To access a web map server, you create a layer object and add it to your map with OpenLayers.

For instance, if you wanted to have a Google Maps and a WMS service displayed on your map, you would use OpenLayers to create a GoogleMaps layer object and a WMS layer object, and then add them to your OpenLayers map. We'll soon see an example with a WMS layer, so don't worry if you're a little confused.

What is a Layer?

Like layers of an onion, each layer is above and will cover up the previous one; the order that you add in the layers is important. With OpenLayers, you can arbitrarily set the overall transparency of any layer, so you are easily able to control how much layers cover each other up, and dynamically change the layer order at any time.

For instance, you could have a Google map as your base layer, a layer with satellite imagery that is semi-transparent, and a vector layer all active on your map at once. A vector layer is a powerful layer that lets us add markers and various geometric objects to our maps—we'll cover it in Chapter 9. Thus, in this example, your map would have three separate layers. We'll go into much more depth about layers and how to use and combine them in Chapter 3.

You have been reading a chapter from
OpenLayers 2.10 Beginner's Guide
Published in: Mar 2011
Publisher:
ISBN-13: 9781849514125
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime