summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/manual/dateline-sketch.html
blob: 1be1f36a06e79cf21a8c2f89e58687e1b1b85df9 (plain)
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
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>OpenLayers: Sketch handlers crossing the dateline</title>
    <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
    <link rel="stylesheet" href="../../examples/style.css" type="text/css">
    <style type="text/css">
        #map {
            height: 512px;
        }
    </style>

    <script src="../../lib/OpenLayers.js"></script>
  </head>
  <body>
    <h1 id="title">OpenLayers sketch handlers crossing the dateline example</h1>

    <div id="tags">
        international date line, dateline, sketch
    </div>
    <p id="shortdesc">
        Start digitizing a polygon or line
        on one side of the international dateline, and then cross the dateline
        whilst digitizing. The feature should behave like digitizing on any
        other location.
    </p>
    <div id="map" class="smallmap"></div>

    <div id="docs">
    </div>
        <script type="text/javascript">

        var map = new OpenLayers.Map('map');

        var base = new OpenLayers.Layer.WMS("marble", 
            "http://demo.opengeo.org/geoserver/wms",
            {layers: "topp:naturalearth"},
            {wrapDateLine: true}
        );
        
        // allow testing of specific renderers via "?renderer=Canvas", etc
        var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
        renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;

        var vector = new OpenLayers.Layer.Vector("Editable Vectors", {renderers: renderer});

        map.addLayers([base, vector]);
        
        var wkt = new OpenLayers.Format.WKT();
        var f = wkt.read("POLYGON((210.8828125 39.7265625,151.8203125 36.2109375,152.171875 -9.4921875,219.3203125 -10.546875,210.8828125 39.7265625))");
        
        var f2 = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-190, 0));
        
        vector.addFeatures([f, f2]);
        
        map.addControl(new OpenLayers.Control.EditingToolbar(vector));

        map.setCenter(new OpenLayers.LonLat(-179, 0), 2);

        </script>

  </body>
</html>