1 | // API key for http://openlayers.org. Please get your own at |
---|
2 | // http://bingmapsportal.com/ and use that instead. |
---|
3 | var apiKey = "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf"; |
---|
4 | |
---|
5 | var map = new OpenLayers.Map('map', { |
---|
6 | controls: [ |
---|
7 | new OpenLayers.Control.Attribution(), |
---|
8 | new OpenLayers.Control.Navigation(), |
---|
9 | new OpenLayers.Control.PanZoomBar(), |
---|
10 | new OpenLayers.Control.LayerSwitcher() |
---|
11 | ] |
---|
12 | }); |
---|
13 | |
---|
14 | var road3 = new OpenLayers.Layer.Bing({ |
---|
15 | name: "Road tiles with 3 zoom levels", |
---|
16 | type: "Road", |
---|
17 | key: apiKey, |
---|
18 | maxResolution: 76.43702827453613, |
---|
19 | numZoomLevels: 3 |
---|
20 | }); |
---|
21 | var road5 = new OpenLayers.Layer.Bing({ |
---|
22 | name: "Road tiles with 5 zoom levels", |
---|
23 | type: "Road", |
---|
24 | key: apiKey, |
---|
25 | numZoomLevels: 5 |
---|
26 | }); |
---|
27 | var road = new OpenLayers.Layer.Bing({ |
---|
28 | name: "Road tiles with all zoom levels", |
---|
29 | type: "Road", |
---|
30 | key: apiKey |
---|
31 | }); |
---|
32 | |
---|
33 | map.addLayers([road3, road5, road]); |
---|
34 | map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform( |
---|
35 | new OpenLayers.Projection("EPSG:4326"), |
---|
36 | map.getProjectionObject() |
---|
37 | ), 1); |
---|