| 1 | [% INCLUDE header.tt page_title = criterion.name || "Map of all nodes" %] |
|---|
| 2 | [% INCLUDE banner.tt %] |
|---|
| 3 | <div id="content"> |
|---|
| 4 | <a href="" id="permalink">Link to this page</a> |
|---|
| 5 | |
|---|
| 6 | <div id="maincontent"> |
|---|
| 7 | |
|---|
| 8 | [% IF gmaps_api_key %] |
|---|
| 9 | <ul style="height:400px; overflow:auto;float:right; width:30%;"> |
|---|
| 10 | [% i = 0 %] |
|---|
| 11 | [% FOREACH node = nodes %] |
|---|
| 12 | [% metadata = node.node_data.metadata %] |
|---|
| 13 | [% i = i + 1 %] |
|---|
| 14 | [% IF metadata.wgs84_lat.list.first AND metadata.wgs84_long.list.first %] |
|---|
| 15 | [% NEXT IF metadata.wgs84_lat.list.first.match('m') %] |
|---|
| 16 | [% NEXT IF metadata.wgs84_long.list.first.match('m') %] |
|---|
| 17 | <li><a href='#' onclick="marker[% i %].openInfoWindowHtml(htmlString[% i %]); return false;">[% node.name %]</a>[% IF metadata.city.list.first %], [% metadata.city.list.first %][% END %]</li> |
|---|
| 18 | [% END %] |
|---|
| 19 | [% END %] |
|---|
| 20 | </ul> |
|---|
| 21 | |
|---|
| 22 | <table width="100%" height="100%"> |
|---|
| 23 | <tr><td><div id="map" style=" width: 65%; height: 450px"></div></td></tr> |
|---|
| 24 | </table> |
|---|
| 25 | |
|---|
| 26 | <script defer="defer" type="text/javascript"> |
|---|
| 27 | //<![CDATA[ |
|---|
| 28 | var map = new GMap2(document.getElementById("map")); |
|---|
| 29 | |
|---|
| 30 | var copycol = new GCopyrightCollection(""); |
|---|
| 31 | var copy = new GCopyright(1, new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)), 0, "©2007 <a href='http://www.openstreetmap.org>OpenStreetMap</a> contributors"); |
|---|
| 32 | copycol.addCopyright(copy); |
|---|
| 33 | var tileMapnik = new GTileLayer(copycol,1,18); |
|---|
| 34 | tileMapnik.myBaseURL = "http://tile.openstreetmap.org/"; |
|---|
| 35 | tileMapnik.getTileUrl=MapnikGetTileUrl; |
|---|
| 36 | tileMapnik.isPng = function () { return true;} |
|---|
| 37 | tileMapnik.getOpacity = function() {return 1.0;} |
|---|
| 38 | |
|---|
| 39 | var layer0 = [tileMapnik]; |
|---|
| 40 | var mapnikMap = new GMapType(layer0, G_SATELLITE_MAP.getProjection(), "OSM", G_SATELLITE_MAP); |
|---|
| 41 | map.addMapType(mapnikMap); |
|---|
| 42 | |
|---|
| 43 | map.addControl(new GLargeMapControl()); |
|---|
| 44 | map.addControl(new GMapTypeControl()); |
|---|
| 45 | |
|---|
| 46 | map.setCenter(new GLatLng([% IF lat %][% lat %][% ELSE %][% centre_lat %][% END %],[% IF long %][% long %][% ELSE %][% centre_long %][% END %]), [% IF zoom %][% zoom %][% ELSE %][% default_gmaps_zoom %][% END %]); |
|---|
| 47 | //map.centerAndZoom(new GPoint([% IF long %][% long %][% ELSE %][% centre_long %][% END %],[% IF lat %][% lat %][% ELSE %][% centre_lat %][% END %]), [% IF zoom %][% zoom %][% ELSE %][% default_gmaps_zoom %][% END %]); |
|---|
| 48 | map.setMapType(mapnikMap); |
|---|
| 49 | |
|---|
| 50 | [% i = 0 %] |
|---|
| 51 | [% FOREACH node = nodes %] |
|---|
| 52 | [% i = i + 1 %] |
|---|
| 53 | [% metadata = node.node_data.metadata %] |
|---|
| 54 | [% IF metadata.wgs84_lat.list.first AND metadata.wgs84_long.list.first %] |
|---|
| 55 | [% NEXT IF metadata.wgs84_lat.list.first.match('m') %] |
|---|
| 56 | [% NEXT IF metadata.wgs84_long.list.first.match('m') %] |
|---|
| 57 | var point[% i %] = new GPoint([% metadata.wgs84_long.list.first %], [% metadata.wgs84_lat.list.first %]); |
|---|
| 58 | var marker[% i %] = new GMarker(point[% i %],baseIcon); |
|---|
| 59 | [% IF metadata.source %] |
|---|
| 60 | [% source_url = metadata.source.list.first.match('^(.*?)\?(?:\?|$)').first %] |
|---|
| 61 | [% END %] |
|---|
| 62 | var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a> <a style='text-decoration:none;' href=\"[% source_url %]?id=[% node.param %];action=edit\">(edit)</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]"; |
|---|
| 63 | GEvent.addListener(marker[% i %], "click", function() { |
|---|
| 64 | marker[% i %].openInfoWindowHtml(htmlString[% i %]); |
|---|
| 65 | }); |
|---|
| 66 | map.addOverlay(marker[% i %]); |
|---|
| 67 | [% END %] |
|---|
| 68 | [% END %] |
|---|
| 69 | function map_recenter() { |
|---|
| 70 | var center = map.getCenterLatLng(); |
|---|
| 71 | var link = document.getElementById('permalink'); |
|---|
| 72 | var zoom = map.getZoomLevel(); |
|---|
| 73 | link.href = "?action=index;format=map&long="+center.x+"&lat="+center.y+"&zoom="+zoom; |
|---|
| 74 | } |
|---|
| 75 | GEvent.addListener(map, "moveend", map_recenter ); |
|---|
| 76 | //]]> |
|---|
| 77 | </script> |
|---|
| 78 | [% ELSE %] |
|---|
| 79 | Sorry, this guide doesn't have Google Maps functionality enabled. |
|---|
| 80 | [% END %] |
|---|
| 81 | |
|---|
| 82 | </div> |
|---|
| 83 | </div> |
|---|
| 84 | |
|---|
| 85 | [% INCLUDE footer.tt %] |
|---|