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="" rel="nofollow"></a>
11 <% unless map.instance_of? Changeset %>
13 <a id="object_larger_map" href="" rel="nofollow"></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' %>";
44 var obj_type = "<%= map.class.name.downcase %>";
45 var obj_id = <%= map.id %>;
46 var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
48 if (obj_type != "node") {
52 addObjectToMap(url, true, function(extent) {
53 $("loading").innerHTML = "";
56 extent.transform(map.getProjectionObject(), map.displayProjection);
58 $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
59 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
61 <% unless map.instance_of? Changeset %>
62 $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
63 $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
66 $("small_map").style.display = "none";