aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map/OSM.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@balti.ukcod.org.uk>2010-11-26 01:49:02 +0000
committerMatthew Somerville <matthew@balti.ukcod.org.uk>2010-11-26 01:49:02 +0000
commit92c0661cf40f9a8e39613784703bb6b2b9ac8a49 (patch)
tree75f5c3c1e910a5042e0a31b6ad6cece8dae26a43 /perllib/FixMyStreet/Map/OSM.pm
parenta17e62af230c2d9aa2fe49d22be990525950c01e (diff)
Some OpenLayers options, including StreetView and CycleMap, and putting tilma within OL.
Diffstat (limited to 'perllib/FixMyStreet/Map/OSM.pm')
-rw-r--r--perllib/FixMyStreet/Map/OSM.pm71
1 files changed, 71 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm
new file mode 100644
index 000000000..ccbb3ca53
--- /dev/null
+++ b/perllib/FixMyStreet/Map/OSM.pm
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+#
+# FixMyStreet:Map::OSM
+# OSM maps on FixMyStreet.
+#
+# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+
+package FixMyStreet::Map;
+
+use strict;
+use mySociety::Web qw(ent);
+
+sub header_js {
+ return '
+<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
+<script type="text/javascript" src="/js/map-OpenStreetMap.js"></script>
+<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script>
+';
+}
+
+# display_map Q PARAMS
+# PARAMS include:
+# EASTING, NORTHING for the centre point of the map
+# TYPE is 1 if the map is clickable, 2 if clickable and has a form upload,
+# 0 if not clickable
+# PINS is array of pins to show, location and colour
+# PRE/POST are HTML to show above/below map
+sub display_map {
+ my ($q, %params) = @_;
+ $params{pre} ||= '';
+ $params{post} ||= '';
+
+ foreach my $pin (@{$params{pins}}) {
+ }
+
+ my $out = FixMyStreet::Map::header($q, $params{type});
+ my $copyright = _('Map &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> and contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>');
+ $out .= <<EOF;
+<script type="text/javascript">
+var fixmystreet = {
+ 'easting': $params{easting},
+ 'northing': $params{northing},
+ 'map_type': OpenLayers.Layer.OSM.Mapnik
+}
+</script>
+<div id="map_box">
+ $params{pre}
+ <div id="map"></div>
+ <p id="copyright">$copyright</p>
+ $params{post}
+</div>
+<div id="side">
+EOF
+ return $out;
+}
+
+sub display_map_end {
+ my ($type) = @_;
+ my $out = '</div>';
+ $out .= '</form>' if ($type);
+ return $out;
+}
+
+sub display_pin {
+}
+
+sub map_pins {
+}
+
+1;