Project

General

Profile

1
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
4

    
5
    <style type="text/css">
6
    body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
7
    body {
8
	border: 0px;
9
	margin: 0px;
10
	padding: 0px;
11
    }
12
    #map {
13
	width: 65%;
14
	height: 100%;
15
	border: 0px;
16
	padding: 0px;
17
    }
18
    </style>
19

    
20
    <script src="../lib/OpenLayers.js"></script>
21
    <script type="text/javascript">
22
      <!--
23
	var lat = 900863; 
24
	var lon = 235829;
25
	var zoom = 6;
26
        var map, layer;
27

    
28
        function init(){
29
	    // these should be object methods or something
30
            map = new OpenLayers.Map( $('map') );
31
            var basemap = new OpenLayers.Layer.WMS( "Boston", 
32
                "http://boston.freemap.in/cgi-bin/mapserv?",
33
                {map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads', format: 'png', 'transparent': 'off'},
34
                {maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), maxResolution: 296985/1024, projection:"EPSG:2805" } );
35
            var rapid = new OpenLayers.Layer.WMS( "Rapid Transit", 
36
                "http://boston.freemap.in/cgi-bin/mapserv?",
37
                {map: '/www/freemap.in/boston/map/mass.map', layers: 'rapid_transit', format: 'png', transparent:'true'} );
38
            var buildings = new OpenLayers.Layer.WMS( "Buildings", 
39
                "http://boston.freemap.in/cgi-bin/mapserv?",
40
                {map: '/www/freemap.in/boston/map/mass.map', layers: 'buildings', format: 'png', transparent:'true'} );
41
                
42
            map.addLayer(basemap);
43
            map.addLayer(rapid);
44
            map.addLayer(buildings);
45
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
46
            map.addControl(new OpenLayers.Control.LayerSwitcher());
47
        }
48
   function getaddress() {
49
      if (!document.getElementById('address').value) {return; }
50
                    document.getElementById('status').innerHTML = "Finding address...";
51
      var address = document.getElementById('address').value;
52
      address = escape(address);
53
      addr = "/geocode.cgi?address="+address;
54
      var handler = XMLrequest();
55
      if (handler) {
56
               handler.onreadystatechange=function() {
57
                   if (handler.readyState == 4 && handler.status == 200) {
58
                   var latlon = handler.responseText;
59
                   latlon = latlon.split(",");
60
                   if (latlon[1]) {
61
                       map.setCenter(new OpenLayers.LonLat(parseFloat(latlon[1]), parseFloat(latlon[0])), 15);
62
                       document.getElementById('status').innerHTML = "";
63
                   
64
                   } else {
65
                    document.getElementById('status').innerHTML = "Could not find address, sorry.";
66
                   }
67
                   }
68
               }
69
               handler.open("GET", addr, true);
70
               handler.send('');
71
           }
72
   }
73
function XMLrequest() {
74
xmlhttp={};
75
try {
76
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
77
} catch (e) {
78
  try {
79
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
80
  } catch (E) { }
81
}
82
try {
83
  xmlhttp = new XMLHttpRequest();
84
} catch (e) {}
85
return xmlhttp;
86
}
87
function setLink() {
88
	var link = document.getElementById("link");
89
	var center = map.getCenter();
90
	var zoom = map.getZoom();
91
	link.innerHTML="http://boston.freemap.in/?zoom="+zoom+"&amp;lat="+center.lat+"&amp;lon="+center.lon;
92
}	
93
//      -->
94
    </script>
95
  </head>
96

    
97
<body onload="init()">
98
<div id="right" style="float:right;width:30%;padding:10px;" ><h1>Boston Free Map</h1><!--Search: <input type="text" id='address' name="address"><input type="submit" value="Go!" onclick="javascript:getaddress()"/>--><div id="status" style="height:20px;min-height:20px;">&nbsp;</div>
99
    <div>Map powered by <a href="http://www.openlayers.org/">OpenLayers</a>
100
	 and <a href="http://mapserver.gis.umn.edu/">MapServer</a>.
101
         Data downloaded from
102
	 <a href="http://www.mass.gov/mgis/">Office of Geographic and Environmental Information (MassGIS)</a>.</div>
103
	 <!--<a onclick="setLink(); return false" href="#" id="update">Update Link</a>
104
	 <div id="link"></div>-->
105
	 </div>
106
    <div id="map"></div>
107
</body>
108
</html>
(9-9/35)