Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • OpenLayers 2.10 Beginner's Guide
  • Toc
  • feedback
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
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
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding controls to your map


There are two methods for adding controls to a map.

  1. Pass in a JavaScript array of OpenLayers Control objects when you instantiate the map object.

  2. Add controls to the map object after it has been created by calling either of the two map functions addControl(), passing in a single control object, or addControls(), passing in an array of control objects.

When you create your map, four control objects are added automatically. These four controls are:

  • OpenLayers.Control.Navigation: Responsible for handling map interaction from mouse events, such as dragging the mouse, zooming with the scroll bar, and double-clicking.

  • OpenLayers.Control.PanZoom: Adds a Pan/Zoom bar to the top left hand side of the map. Contains up/down/left/right arrows for panning, and zoom in, zoom out, and zoom to maximum map extent buttons for zooming.

  • OpenLayers.Control.ArgParser: Allows the map to zoom to a specific location and turn on/off layers based on the URL that you call the map with. In other...

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