File: web-mercator.js

package info (click to toggle)
openlayers 2.13.1%2Bds2-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 67,252 kB
  • sloc: javascript: 61,721; xml: 7,435; python: 907; sh: 44; makefile: 19
file content (37 lines) | stat: -rw-r--r-- 1,156 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// make map available for easy debugging
var map;

function init() {

    var options = {
        projection: new OpenLayers.Projection("EPSG:102113"),
        units: "m",
        numZoomLevels: 18,
        maxResolution: 156543.0339,
        maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                         20037508, 20037508.34)
    };
    map = new OpenLayers.Map('map', options);

    // create Google layer with EPSG:102113 code
    var gsat = new OpenLayers.Layer.Google("Google Imagery", {
        type: G_SATELLITE_MAP, 
        sphericalMercator: true,
        projection: "EPSG:102113"
    });

    // create WMS layer
    var wms = new OpenLayers.Layer.WMS(
        "Highways",
        "http://sampleserver1.arcgisonline.com/arcgis/services/Specialty/ESRI_StateCityHighway_USA/MapServer/WMSServer",
        {layers: "2", format: "image/gif", transparent: "true"},
        {
            isBaseLayer: false,
            wrapDateLine: true
        }
    );

    map.addLayers([gsat, wms]);
    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.setCenter(new OpenLayers.LonLat(-10723197, 4500612), 3);
}