This recipe will make use of every other recipe in this chapter and build on them. We are going to make an interactive map with four layers on it. Two maps, the Canadian provinces from the previous recipe and a layer with some Canadian cities. We will also add a control to show or hide the individual layers.
Since this recipe is going to make use of everything in the previous recipes, it is advised to read the beginning of this chapter.
The following are the steps required to add multiple layers to a map:
Start by generating the data. Use the region data from the previous recipe and we will create data for Canadian cities using the following site as reference, http://www.infoplease.com/ipa/A0001796.html. The following code snippet shows you how to store one city:
dataCity.push( new LongLat("Calgary", new Coordinate("W", 114, 1), new Coordinate("N", 51, 1)));
Instantiate a
Map
class just as we have been doing this entire chapter.Create...