]> dev.renevier.net Git - syj.git/blob - public/js/syjraw.js
raw mode to display map
[syj.git] / public / js / syjraw.js
1 var WGS84 = new OpenLayers.Projection("EPSG:4326");
2 var Mercator = new OpenLayers.Projection("EPSG:900913");
3
4 var styleMap = {
5     view: new OpenLayers.StyleMap({
6         "default": new OpenLayers.Style({
7             strokeColor: "blue",
8             strokeWidth: 5,
9             strokeOpacity: 0.7
10         })
11     })
12 };
13
14 function init() {
15     var map = new OpenLayers.Map('map', {
16                 controls: [ new OpenLayers.Control.Attribution() ],
17                 theme: null}),
18
19          baseLayer = new OpenLayers.Layer.OSM("OSM", null, { attribution: SyjStrings.osmAttribution }),
20
21          layerOptions = {format:     OpenLayers.Format.WKT,
22                         projection: WGS84,
23                         styleMap:   styleMap.view,
24                         attribution: SyjStrings.geomAttribution },
25
26         viewLayer = new OpenLayers.Layer.Vector("View Layer", layerOptions),
27         wkt = new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 });
28
29     map.addLayers([baseLayer, viewLayer]);
30     viewLayer.addFeatures([wkt.read(gInitialGeom.data)]);
31     extent = viewLayer.getDataExtent();
32     map.updateSize();
33     map.zoomToExtent(extent);
34
35 }
36
37 if (window.addEventListener) {
38     window.addEventListener("load", init, false);
39 } else {
40     window.attachEvent("onload", init);
41 }