1 var WGS84 = new OpenLayers.Projection("EPSG:4326");
2 var Mercator = new OpenLayers.Projection("EPSG:900913");
5 view: new OpenLayers.StyleMap({
6 "default": new OpenLayers.Style({
14 function resizeMap() {
15 var map = document.getElementById('map');
16 map.style.width = map.offsetWidth.toString() + 'px';
17 map.style.height = map.offsetHeight.toString() + 'px';
20 function mapquestLayer() {
21 return new OpenLayers.Layer.OSM("Mapquest", [
22 'http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
23 'http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
24 'http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
25 'http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png'],
26 { attribution: SyjStrings.mapquestAttribution});
30 return new OpenLayers.Layer.OSM("OSM", [
31 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
32 'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
33 'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'],
34 { attribution: SyjStrings.osmAttribution});
38 var map = new OpenLayers.Map('map', {
39 controls: [ new OpenLayers.Control.Attribution() ],
42 parameters = OpenLayers.Util.getParameters(window.location.href),
45 layerOptions = {format: OpenLayers.Format.WKT,
47 styleMap: styleMap.view,
48 attribution: SyjStrings.geomAttribution },
50 viewLayer = new OpenLayers.Layer.Vector("View Layer", layerOptions),
51 wkt = new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 });
53 if (parameters.layer) {
54 switch (parameters.layer.toUpperCase()) {
56 baseLayer = mapquestLayer();
59 baseLayer = osmLayer();
65 baseLayer = osmLayer();
68 map.addLayers([baseLayer, viewLayer]);
69 viewLayer.addFeatures([wkt.read(gInitialGeom.data)]);
70 extent = viewLayer.getDataExtent();
72 map.zoomToExtent(extent);
76 window.onresize = function() {
80 if (window.addEventListener) {
81 window.addEventListener("load", init, false);
83 window.attachEvent("onload", init);