1 <%= javascript_include_tag '/openlayers/OpenLayers.js' %>
2 <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
3 <%= javascript_include_tag 'map.js' %>
5 <% if map.instance_of? Changeset or map.visible %>
6 <div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
8 <span id="loading"><%= t 'browse.map.loading' %></span>
9 <a id="area_larger_map" href=""></a>
10 <% unless map.instance_of? Changeset %>
12 <a id="object_larger_map" href=""></a>
15 <%= t 'browse.map.deleted' %>
18 <% if map.instance_of? Changeset or map.visible %>
19 <script type="text/javascript">
20 OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
23 var map = createMap("small_map", {
24 controls: [ new OpenLayers.Control.Navigation() ]
27 <% if map.instance_of? Changeset %>
28 var minlon = <%= map.min_lon / GeoRecord::SCALE.to_f %>;
29 var minlat = <%= map.min_lat / GeoRecord::SCALE.to_f %>;
30 var maxlon = <%= map.max_lon / GeoRecord::SCALE.to_f %>;
31 var maxlat = <%= map.max_lat / GeoRecord::SCALE.to_f %>;
32 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
37 $("loading").innerHTML = "";
39 $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
40 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
42 var obj_type = "<%= map.class.name.downcase %>";
43 var obj_id = <%= map.id %>;
44 var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
46 if (obj_type != "node") {
50 addObjectToMap(url, true, function(extent) {
51 $("loading").innerHTML = "";
54 extent.transform(map.getProjectionObject(), map.displayProjection);
56 $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
57 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
59 <% unless map.instance_of? Changeset %>
60 $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
61 $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
64 $("small_map").style.display = "none";