File: map.html

package info (click to toggle)
cyclograph 1.7.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,136 kB
  • ctags: 705
  • sloc: python: 9,682; makefile: 5
file content (84 lines) | stat: -rw-r--r-- 2,032 bytes parent folder | download | duplicates (5)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<html>
<head>

<style type="text/css">
    h2 {
            margin-left:100px;
            color: #000066; 
            font-size: 24px 
       }

    h3 {
            margin-left:150px;
            color: #000000; 
            font-size: 16px 
       }

    p  {
            margin-left:150px;
            margin-right:250px;
            color: #000000;
       }

    b  {
            font-size: 18px
       }
</style>

</head>
<body>
<div>

<div id="map" class="smallmap"></div>

<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">

vectorlayer = new OpenLayers.Layer.Vector("Vector Layer", {style: {strokeColor: "blue", strokeWidth: 5, strokeOpacity: 0.6}});

map = new OpenLayers.Map({
    div: "map",
    layers: [
        new OpenLayers.Layer.OSM(
            "OpenCycleMap",
            ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
                "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
                "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"],
            { type: 'png', displayOutsideMaxExtent: true,
                transitionEffect: 'resize'}
        ),
        new OpenLayers.Layer.OSM(
            "OpenStreetMap"
        ),
        vectorlayer
    ],
projection: new OpenLayers.Projection("EPSG:4326"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});

map.addControl(new OpenLayers.Control.LayerSwitcher());

wkt = new OpenLayers.Format.WKT();
var features = wkt.read("LINESTRING(%s)");

if(features){
    features.geometry.transform(map.displayProjection, map.getProjectionObject());
    if(features.constructor != Array){
        features = [features];
    }
    bounds = features[0].geometry.getBounds();
    for(var i=1; i<features.length; ++i){
        bounds.extend(features[i].geometry.getBounds());
    }
    vectorlayer.addFeatures(features);
    map.zoomToExtent(bounds);
}

window.onresize = function() { map.zoomToExtent(bounds); }

</script>

</div>
</body>
</html>