1 <%= javascript_include_tag '/openlayers/OpenLayers.js' %>
2 <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
3 <%= javascript_include_tag 'map.js' %>
5 <div style="width: 250px; margin: auto; text-align: right"">
6 <% if map.instance_of? Changeset or map.visible %>
7 <div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
9 <span id="loading"><%= t 'browse.map.loading' %></span>
10 <a id="area_larger_map" href=""></a>
11 <% unless map.instance_of? Changeset %>
13 <a id="object_larger_map" href=""></a>
16 <%= t 'browse.map.deleted' %>
20 <% if map.instance_of? Changeset or map.visible %>
21 <script type="text/javascript">
22 OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
25 var map = createMap("small_map", {
26 controls: [ new OpenLayers.Control.Navigation() ]
29 <% if map.instance_of? Changeset %>
30 var minlon = <%= map.min_lon / GeoRecord::SCALE.to_f %>;
31 var minlat = <%= map.min_lat / GeoRecord::SCALE.to_f %>;
32 var maxlon = <%= map.max_lon / GeoRecord::SCALE.to_f %>;
33 var maxlat = <%= map.max_lat / GeoRecord::SCALE.to_f %>;
34 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
39 $("loading").innerHTML = "";
41 $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
42 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
43 <% else if map.instance_of? MapBug %>
44 $("loading").innerHTML = "";
45 var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>);
47 setMapCenter(centre, zoom);
48 marker = addMarkerToMap(centre);
49 $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>';
50 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
52 var obj_type = "<%= map.class.name.downcase %>";
53 var obj_id = <%= map.id %>;
54 var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
56 if (obj_type != "node") {
60 addObjectToMap(url, true, function(extent) {
61 $("loading").innerHTML = "";
64 extent.transform(map.getProjectionObject(), map.displayProjection);
66 $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
67 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
69 <% unless map.instance_of? Changeset %>
70 $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
71 $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
74 $("small_map").style.display = "none";