O'Reilly logo

OpenLayers 2.10 by Erik Hazzard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multiple maps

So far, we've only used one map in all our examples. And, for most applications, only one map is required. There are times though when having two maps is a good thing—like when you're learning about how the Map class works (although, I'm sure you can be a bit more creative).

Using multiple map objects

Making two map objects on your page isn't too hard. We just need another element to place the second map element in, along with adding controls and layers to map—things we've been doing throughout the book.

We've talked about how control and layer objects belong to a single map object. But what if you want to have multiple map objects that use the same layers? A single layer object can only belong to one map object at a time, but fortunately ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required