Commit f1875095 authored by David Read's avatar David Read
Browse files

[noticket] Remove carparks demo - it is old and has minor https issue, map...

[noticket] Remove carparks demo - it is old and has minor https issue, map tiles too, and relies on dev1 datastore.
parent 158252d5
......@@ -184,9 +184,6 @@ class DataController(BaseController):
else:
abort(404)
def carparks(self):
return render('data/carparks.html')
def viz_social_investment_and_foundations(self):
return render('viz/social_investment_and_foundations.html')
def viz_investment_readiness_programme(self):
......
......@@ -190,7 +190,6 @@ class ThemePlugin(p.SingletonPlugin):
map.connect('/data/openspending-report/index', controller=data_controller, action='openspending_report')
map.connect('/data/openspending-report/{id}', controller=data_controller, action='openspending_publisher_report')
map.connect('/data/openspending-report/{id}', controller=data_controller, action='openspending_publisher_report')
map.connect('/data/carparks', controller=data_controller, action='carparks')
map.connect('/data/resource_cache/{root}/{resource_id}/{filename}', controller=data_controller, action='resource_cache')
map.connect('/data/viz/social-investment-and-foundations', controller=data_controller, action='viz_social_investment_and_foundations')
map.connect('/data/viz/investment-readiness-programme', controller=data_controller, action='viz_investment_readiness_programme')
......
<!DOCTYPE HTML>
<html>
<head>
<title>OpenLayers Demo</title>
<style type="text/css">
html, body, #basicMap {
width: 520px;
height: 520px;
margin: 0;
}
</style>
<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-combined.js"></script>
<script>
//<![CDATA[
$(document).ready(function(){
DatastoreExample = {}
// Setup the required project transformation: carpark data is in the
// Ordance Survey's EPSG:27700 projection.
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";
Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
var fromProjection = new OpenLayers.Projection("EPSG:27700"); // Transform from Ordnance Survey Projection
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
// Map options.
var options = {
//restrictedExtent : extent,
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution()
]
};
map = new OpenLayers.Map("basicMap", options);
// Mapnik layer
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
// Default postiion and zoom until data is available.
var position = new OpenLayers.LonLat(568225, 286756).transform( fromProjection, toProjection);
var zoom = 5;
// Setup the markers layer.
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
map.zoomToMaxExtent();
DatastoreExample.search = function(q) {
markers.clearMarkers();
// fetch carpark data to draw it on the marker layer
$.ajax({
url: "http://co-dev1.dh.bytemark.co.uk/api/3/action/datastore_search",
dataType: "json",
success: function(data, textStatus, jqXHR){
var records = data['result']['records'];
var avgEasting = 0;
var avgNorthing = 0;
for (var i=0; i < records.length; i++) {
var carpark = records[i];
var easting = parseInt(carpark['Easting']);
var northing = parseInt(carpark['Northing']);
var position = new OpenLayers.LonLat(easting, northing).transform(fromProjection, toProjection);
markers.addMarker(new OpenLayers.Marker(position));
avgEasting += easting;
avgNorthing += northing;
}
markers.redraw();
mapnik.redraw();
if (records.length > 0) {
avgEasting = avgEasting / records.length;
avgNorthing = avgNorthing / records.length;
var avgPosition = new OpenLayers.LonLat(avgEasting, avgNorthing).transform(fromProjection, toProjection);
map.setCenter(avgPosition, zoom);
}
},
data: { resource_id: "13aa40a1-d0f0-44e2-a7ee-14de01ec9780",
q: q,
limit: 100,
fields: ["Easting", "Northing"],
},
traditional: true,
error: function(jqXHR, textStatus, errorThrown){
alert("Oh dear.");
}
})
};
$('#freetext-query-button').click(function(){
DatastoreExample.search($('#freetext-query').val());
});
DatastoreExample.search("Yorkshire");
});
// ]]>
</script>
</head>
<body>
<div>
<label class="inline" for="freetext-query">Search:</label>
<input class="input-small" id="freetext-query" name="freetext-query" type="text" value="Yorkshire"/>
<input id="freetext-query-button" type="button" value="Search"/>
</div>
<div id="basicMap"></div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment