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 there is a simple way to use the 'same' layer object in multiple maps—by calling the layer's (or control's) clone()
method.