source: trunk/openspace.npemap.org.uk/index.html @ 617

Last change on this file since 617 was 617, checked in by Nick Burch, 12 years ago

CSS etc

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1<html xmlns="http://www.w3.org/1999/xhtml">
2<head>
3<title>NPEMap browsing via OS OpenSpace</title>
4<script type="text/javascript" src="http://openspace.ordnancesurvey.co.uk/osmapapi/openspace.js?key=413F829AAE11F96EE0405F0AF060395F"></script>
5
6<script src="yahoo.js" type="text/javascript"></script>
7<script src="dom.js" type="text/javascript"></script>
8<script src="event.js" type="text/javascript"></script>
9<script src="jsr_class.js" type="text/javascript"></script>
10<script src="jscoord-1.1.1.js" type="text/javascript"></script>
11<script src="prototype.js" type="text/javascript"></script>
12</head>
13<body onload="init()">
14
15<script type="text/javascript">
16<!--
17
18var osMap;
19var markers;
20var url = "/cgi/get-postcodes.fcgi";
21var grid = "osgb";
22
23var sources = new Array(1);
24sources[0] = 'this site';
25sources[1] = '<a href="http://www.freethepostcode.org/">freethepostcode.org</a>';
26sources[2] = '<a href="http://www.npemap.org.uk">npemap</a>';
27
28var successHandler = function(o){
29  eval(o.responseText);
30}
31
32var failHander = function(o) {
33  // Don't do anything
34  $('spinner').innerHTML = '<p class="error">Problem showing existing data.</p>';
35}
36
37function drawExisting() {
38        // Clear all our makers
39        for(var marker in osMap.markers) {
40                markers.removeMarker(marker);
41                alert(marker);
42        }
43        markers.clearMarkers();
44
45        // Only display at zoom levels 8+
46        if(osMap.zoom < 8) {
47                return;
48        }
49
50        var bounds = osMap.calculateBounds();
51        var params = "mineasting=" + bounds.left + "&maxeasting="  + bounds.right + "&minnorthing=" + bounds.bottom + "&maxnorthing=" + bounds.top + "&grid=" + grid;
52        $('spinner').innerHTML = '<p>Fetching postcodes, please wait</p>';
53
54        var myAjax = new Ajax.Request(url, {
55                method: 'get',
56                parameters: params,
57                onComplete: successHandler,
58                onFailure: failHander
59        });
60}
61
62function addNew(e) {
63        var en = 
64                osMap.getLonLatFromViewPortPx( osMap.events.getMousePosition(e) );
65        var easting = en.lon;
66        var northing = en.lat;
67        alert("e=" + easting + " n=" + northing);
68}
69
70function init()
71{
72        osMap = new OpenSpace.Map('map');
73        osMap.setCenter(new OpenSpace.MapPoint(438760, 114760), 8);
74       
75        markers = new OpenLayers.Layer.Markers("Markers");
76        osMap.addLayer(markers);
77
78        osMap.events.register("moveend", osMap, drawExisting);
79        osMap.events.register("zoomend", osMap, drawExisting);
80        osMap.events.register("click", osMap, addNew);
81       
82        drawExisting();
83}
84
85function addMarker(postcode, easting, northing, others ) {
86        var id = others[0];
87        var source = others[1];
88
89        var pos = new OpenSpace.MapPoint(easting, northing);
90        var content = "<div><b>Postcode:</b> " + postcode + "<br /><b>Location:</b> " + easting + ", " + northing + "<br /><b>Source:</b> " + sources[source] + "<br /><b>ID:</b> " + id + "</div>";
91
92        var marker = osMap.createMarker(pos, null, content);
93        markers.addMarker(marker);               
94}
95
96function completeMarkers() {
97        $('spinner').innerHTML = "&nbsp;";
98}
99
100// -->
101</script>
102
103<h1 style="text-align: center; width: 100%; background-color: #DDFF9b;">NPEMap browsing via OS OpenSpace</h1>
104
105<div id="info" style="width: 20%; float: right; background-color: #F0FFD2; border: 1px solid #DDFF9b; padding: 10px; ">
106 This site allows you to browse the
107 <a href="http://www.npemap.org.uk/">NPEMap</a> free postcode dataset,
108 using
109 <a href="http://openspace.ordnancesurvey.co.uk/">OpenSpace</a> maps.
110 <br />
111 <br />
112 If you happen to spot any problems with any of our postcodes, please click
113  on the marker and enter a problem report to let us know.
114 <br />
115 <br />
116 Owing to the terms of the OpenSpace licence, it is not possible to submit
117  new postcodes using these maps. Please use the
118  <a id="npe-link" href="http://www.npemap.org.uk/">main NPEMap site</a>
119  to add additional postcodes.
120</div>
121
122<div id="map" style="width: 75%; height: 80%; border: 1px solid black;"></div>
123
124<div id="notice" style="width: 75%; border: 1px solid black; font-size: 8px; font-family: sans-serif;">
125 Reproduced by
126 <a href="http://openspace.ordnancesurvey.co.uk/openspace/developeragreement.html">permission</a>
127 of Ordnance Survey on behalf of HMSO. &copy;
128 Crown copyright and database right 2007. All rights reserved.
129</div>
130
131<div id="spinner" />
132
133</body>
134</html>
Note: See TracBrowser for help on using the repository browser.