1 <% form_tag :action => 'next' do %>
3 <p class="export_heading">Area to Export</p>
5 <div class="export_bounds">
6 <%= text_field('export', 'maxlat', { :size => 10, :class => "export_bound" }) %>
8 <%= text_field('export', 'minlon', { :size => 10, :class => "export_bound" }) %>
9 <%= text_field('export', 'maxlon', { :size => 10, :class => "export_bound" }) %>
11 <%= text_field('export', 'minlat', { :size => 10, :class => "export_bound" }) %>
14 <p class="export_heading">Format to Export</p>
16 <div class="export_details">
17 <%= radio_button('export', 'format', 'osm' ) %>OpenStreetMap XML Data
19 <%= radio_button('export', 'format', 'png' ) %>PNG Image
21 <%= radio_button('export', 'format', 'pdf' ) %>PDF Document
23 <%= radio_button('export', 'format', 'svg' ) %>SVG Document
27 <p class="export_heading">Licence</p>
29 <div class="export_details">
30 <p>OSM license agreement blah blah blah...</p>
34 <div id="export_mapnik">
35 <p class="export_heading">Options</p>
37 <div class="export_details">
38 <p>Scale 1 : <%= text_field('export', 'mapnik_scale', { :size => 10 }) %></p>
44 <script type="text/javascript">
46 function startExport() {
47 var vectors = new OpenLayers.Layer.Vector("Vector Layer", {
48 displayInLayerSwitcher: false,
50 map.addLayer(vectors);
52 var box = new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.RegularPolygon, {
54 keyMask: OpenLayers.Handler.MOD_CTRL,
59 callbacks: { done: boxComplete }
66 map.events.register("moveend", map, mapMoved);
67 updateRegion(map.getExtent());
70 function setFormat(format) {
71 $("export_osm").style.display = "none";
72 $("export_mapnik").style.display = "none";
73 $("export_" + format).style.display = "inline";
76 $("export_format_osm").onclick = function() { setFormat("osm") };
77 $("export_format_png").onclick = function() { setFormat("mapnik") };
78 $("export_format_pdf").onclick = function() { setFormat("mapnik") };
79 $("export_format_svg").onclick = function() { setFormat("mapnik") };
82 updateRegion(map.getExtent());
85 function boxComplete(box) {
86 map.events.unregister("moveend", map, mapMoved);
87 updateRegion(box.getBounds());
90 function updateRegion(bounds) {
91 var decimals = Math.pow(10, Math.floor(map.getZoom() / 3));
92 var bl = mercatorToLonLat(new OpenLayers.LonLat(bounds.left, bounds.bottom));
93 var tr = mercatorToLonLat(new OpenLayers.LonLat(bounds.right, bounds.top));
95 $("export_maxlat").value = Math.round(tr.lat * decimals) / decimals;
96 $("export_minlon").value = Math.round(bl.lon * decimals) / decimals;
97 $("export_maxlon").value = Math.round(tr.lon * decimals) / decimals;
98 $("export_minlat").value = Math.round(bl.lat * decimals) / decimals;