split_node_tags: Merge changes from main branch.
|
@ -594,8 +594,8 @@ class AmfController < ApplicationController
|
|||
# the delete_with_relations_and_nodes_and_history method should do this,
|
||||
# but at present it just throws a 'precondition failed'
|
||||
way=way.to_i
|
||||
db_now='@now'+(rand*100).to_i.to_s+uid.to_s+id.to_i.abs.to_s+Time.new.to_i.to_s
|
||||
db_uqn='unin'+(rand*100).to_i.to_s+uid.to_s+way.to_i.abs.to_s+Time.new.to_i.to_s
|
||||
db_now='@now'+(rand*100).to_i.to_s+uid.to_s+way.abs.to_s+Time.new.to_i.to_s
|
||||
db_uqn='unin'+(rand*100).to_i.to_s+uid.to_s+way.abs.to_s+Time.new.to_i.to_s
|
||||
ActiveRecord::Base.connection.execute("SET #{db_now}=NOW()")
|
||||
createuniquenodes(way,db_uqn,[])
|
||||
deleteuniquenoderelations(db_uqn,uid,db_now)
|
||||
|
|
|
@ -79,8 +79,9 @@ class ApiController < ApplicationController
|
|||
exit!
|
||||
end
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\""
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
end
|
||||
|
||||
def map
|
||||
|
@ -189,6 +190,8 @@ class ApiController < ApplicationController
|
|||
doc.root << relation.to_xml_node(user_display_name_cache)
|
||||
end
|
||||
|
||||
response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\""
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
|
||||
#exit when we have too many requests
|
||||
|
|
|
@ -30,11 +30,16 @@ class DiaryEntryController < ApplicationController
|
|||
def list
|
||||
if params[:display_name]
|
||||
@this_user = User.find_by_display_name(params[:display_name])
|
||||
@title = @this_user.display_name + "'s diary"
|
||||
@entry_pages, @entries = paginate(:diary_entries,
|
||||
:conditions => ['user_id = ?', @this_user.id],
|
||||
:order => 'created_at DESC',
|
||||
:per_page => 20)
|
||||
if @this_user
|
||||
@title = @this_user.display_name + "'s diary"
|
||||
@entry_pages, @entries = paginate(:diary_entries,
|
||||
:conditions => ['user_id = ?', @this_user.id],
|
||||
:order => 'created_at DESC',
|
||||
:per_page => 20)
|
||||
else
|
||||
@not_found_user = params[:display_name]
|
||||
render :action => 'no_such_user', :status => :not_found
|
||||
end
|
||||
else
|
||||
@title = "Users' diaries"
|
||||
@entry_pages, @entries = paginate(:diary_entries,
|
||||
|
|
25
app/controllers/export_controller.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
class ExportController < ApplicationController
|
||||
def start
|
||||
end
|
||||
|
||||
def finish
|
||||
bbox = BoundingBox.new(params[:minlon], params[:minlat], params[:maxlon], params[:maxlat])
|
||||
format = params[:format]
|
||||
|
||||
if format == "osm"
|
||||
redirect_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=#{bbox}"
|
||||
elsif format == "mapnik"
|
||||
format = params[:mapnik_format]
|
||||
scale = params[:mapnik_scale]
|
||||
|
||||
redirect_to "http://tile.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}"
|
||||
elsif format == "osmarender"
|
||||
format = params[:osmarender_format]
|
||||
zoom = params[:osmarender_zoom].to_i
|
||||
width = bbox.slippy_width(zoom).to_i
|
||||
height = bbox.slippy_height(zoom).to_i
|
||||
|
||||
redirect_to "http://tah.openstreetmap.org/MapOf/index.php?long=#{bbox.centre_lon}&lat=#{bbox.centre_lat}&z=#{zoom}&w=#{width}&h=#{height}&format=#{format}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -129,20 +129,54 @@ private
|
|||
type = named.attributes["info"].to_s.capitalize
|
||||
name = named.attributes["name"].to_s
|
||||
description = named.elements["description"].to_s
|
||||
|
||||
if name.empty?
|
||||
prefix = ""
|
||||
name = type
|
||||
else
|
||||
prefix = "#{type} "
|
||||
end
|
||||
|
||||
if place
|
||||
distance = format_distance(place.attributes["approxdistance"].to_i)
|
||||
direction = format_direction(place.attributes["direction"].to_i)
|
||||
placename = place.attributes["name"].to_s
|
||||
placename = format_name(place.attributes["name"].to_s)
|
||||
suffix = ", #{distance} #{direction} of #{placename}"
|
||||
|
||||
if place.attributes["rank"].to_i <= 30
|
||||
parent = nil
|
||||
parentrank = 0
|
||||
parentscore = 0
|
||||
|
||||
place.elements.each("nearestplaces/named") do |nearest|
|
||||
nearestrank = nearest.attributes["rank"].to_i
|
||||
nearestscore = nearestrank / nearest.attributes["distance"].to_f
|
||||
|
||||
if nearestrank > 30 and
|
||||
( nearestscore > parentscore or
|
||||
( nearestscore == parentscore and nearestrank > parentrank ) )
|
||||
parent = nearest
|
||||
parentrank = nearestrank
|
||||
parentscore = nearestscore
|
||||
end
|
||||
end
|
||||
|
||||
if parent
|
||||
parentname = format_name(parent.attributes["name"].to_s)
|
||||
|
||||
if place.attributes["info"].to_s == "suburb"
|
||||
suffix = "#{suffix}, #{parentname}"
|
||||
else
|
||||
parentdistance = format_distance(parent.attributes["approxdistance"].to_i)
|
||||
parentdirection = format_direction(parent.attributes["direction"].to_i)
|
||||
suffix = "#{suffix} (#{parentdistance} #{parentdirection} of #{parentname})"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
suffix = ""
|
||||
end
|
||||
|
||||
results.push({:lat => lat, :lon => lon, :zoom => zoom,
|
||||
:prefix => prefix, :name => name, :suffix => suffix,
|
||||
:description => description})
|
||||
|
@ -245,6 +279,10 @@ private
|
|||
return "west"
|
||||
end
|
||||
|
||||
def format_name(name)
|
||||
return name.gsub(/( *\[[^\]]*\])*$/, "")
|
||||
end
|
||||
|
||||
def count_results(results)
|
||||
count = 0
|
||||
|
||||
|
|
|
@ -20,6 +20,18 @@ class MessageController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ])
|
||||
if !@message.message_read
|
||||
flash[:notice] = 'Message not read and so not deleted'
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
else
|
||||
flash[:notice] = "Message '#{@message.title}' deleted"
|
||||
@message.destroy
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ])
|
||||
title = message.title.sub(/^Re:\s*/, "Re: ")
|
||||
|
|
|
@ -2,15 +2,7 @@ class SiteController < ApplicationController
|
|||
before_filter :authorize_web
|
||||
before_filter :require_user, :only => [:edit]
|
||||
|
||||
def goto_way
|
||||
way = Way.find(params[:id])
|
||||
|
||||
begin
|
||||
node = way.way_nodes.first.node
|
||||
redirect_to :controller => 'site', :action => 'index', :lat => node.latitude, :lon => node.longitude, :zoom => 6
|
||||
rescue
|
||||
redirect_to :back
|
||||
end
|
||||
def export
|
||||
render :action => 'index'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -11,6 +11,8 @@ class UserController < ApplicationController
|
|||
@title = 'create account'
|
||||
@user = User.new(params[:user])
|
||||
|
||||
@user.data_public = true
|
||||
|
||||
if @user.save
|
||||
token = @user.tokens.create
|
||||
flash[:notice] = "User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)<br>Please note that you won't be able to login until you've received and confirmed your email address."
|
||||
|
@ -179,7 +181,8 @@ class UserController < ApplicationController
|
|||
if @this_user
|
||||
@title = @this_user.display_name
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
@not_found_user = params[:display_name]
|
||||
render :action => 'no_such_user', :status => :not_found
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
# Update and read user preferences, which are arbitrayr key/val pairs
|
||||
class UserPreferenceController < ApplicationController
|
||||
before_filter :authorize
|
||||
|
||||
def read
|
||||
def read_one
|
||||
pref = UserPreference.find(:first, :conditions => ['user_id = ? AND k = ?', @user.id, params[:preference_key]])
|
||||
|
||||
if pref
|
||||
render :text => pref.v.to_s
|
||||
else
|
||||
render :text => 'OH NOES! PREF NOT FOUND!', :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
def update_one
|
||||
pref = UserPreference.find(:first, :conditions => ['user_id = ? AND k = ?', @user.id, params[:preference_key]])
|
||||
|
||||
if pref
|
||||
pref.v = request.raw_post.chomp
|
||||
pref.save
|
||||
else
|
||||
pref = UserPreference.new
|
||||
pref.user = @user
|
||||
pref.k = params[:preference_key]
|
||||
pref.v = request.raw_post.chomp
|
||||
pref.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# print out all the preferences as a big xml block
|
||||
def read
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
prefs = @user.preferences
|
||||
|
@ -15,9 +42,9 @@ class UserPreferenceController < ApplicationController
|
|||
|
||||
doc.root << el1
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
|
||||
end
|
||||
|
||||
# update the entire set of preferences
|
||||
def update
|
||||
begin
|
||||
p = XML::Parser.new
|
||||
|
@ -30,12 +57,12 @@ class UserPreferenceController < ApplicationController
|
|||
|
||||
doc.find('//preferences/preference').each do |pt|
|
||||
pref = UserPreference.new
|
||||
|
||||
|
||||
unless keyhash[pt['k']].nil? # already have that key
|
||||
render :text => 'OH NOES! CAN HAS UNIQUE KEYS?', :status => :not_acceptable
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
keyhash[pt['k']] = 1
|
||||
|
||||
pref.k = pt['k']
|
||||
|
|
|
@ -2,4 +2,8 @@ module ApplicationHelper
|
|||
def htmlize(text)
|
||||
return sanitize(auto_link(simple_format(text), :urls))
|
||||
end
|
||||
|
||||
def rss_link_to(*args)
|
||||
return link_to(image_tag("RSS.gif", :size => "16x16", :border => 0), Hash[*args], { :class => "rsssmall" });
|
||||
end
|
||||
end
|
||||
|
|
2
app/helpers/export_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module ExportHelper
|
||||
end
|
|
@ -35,6 +35,8 @@ class Notifier < ActionMailer::Base
|
|||
headers "Auto-Submitted" => "auto-generated"
|
||||
body :trace_name => trace.name,
|
||||
:trace_points => trace.size,
|
||||
:trace_description => trace.description,
|
||||
:trace_tags => trace.tags,
|
||||
:possible_points => possible_points
|
||||
end
|
||||
|
||||
|
@ -44,6 +46,8 @@ class Notifier < ActionMailer::Base
|
|||
subject "[OpenStreetMap] GPX Import failure"
|
||||
headers "Auto-Submitted" => "auto-generated"
|
||||
body :trace_name => trace.name,
|
||||
:trace_description => trace.description,
|
||||
:trace_tags => trace.tags,
|
||||
:error => error
|
||||
end
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ class Trace < ActiveRecord::Base
|
|||
if first
|
||||
f_lat = point['latitude']
|
||||
f_lon = point['longitude']
|
||||
first = false
|
||||
end
|
||||
|
||||
tp = Tracepoint.new
|
||||
|
|
|
@ -28,5 +28,5 @@
|
|||
|
||||
<br />
|
||||
|
||||
<%= link_to(image_tag("RSS.gif", :size => "16x16", :border => 0), :action => 'rss') %>
|
||||
<%= auto_discovery_link_tag(:atom, :action => 'rss') %>
|
||||
<%= rss_link_to :action => 'rss' %>
|
||||
<%= auto_discovery_link_tag :atom, :action => 'rss' %>
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
<td><%= f.text_area :body, :cols => 80 %></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>Location</th>
|
||||
<td><a name="map"></a><div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px; display: none;"></div>
|
||||
<span class="location">Latitude: <%= f.text_field :latitude, :size => 20, :id => "latitude" %> Longitude: <%= f.text_field :longitude, :size => 20, :id => "longitude" %></span> <a href="#map" id="usemap" onclick="document.getElementById('map').style.display = 'block'; document.getElementById('usemap').style.display = 'none';">use map</a> </td>
|
||||
</tr>
|
||||
<th>Location</th>
|
||||
<td>
|
||||
<div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px; display: none;"></div>
|
||||
<span class="location">Latitude: <%= f.text_field :latitude, :size => 20, :id => "latitude" %> Longitude: <%= f.text_field :longitude, :size => 20, :id => "longitude" %></span>
|
||||
<a href="javascript:openMap()" id="usemap">use map</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><%= submit_tag 'Save' %></td>
|
||||
|
@ -40,13 +43,13 @@
|
|||
<!--
|
||||
var marker;
|
||||
|
||||
function init(){
|
||||
var centre = lonLatToMercator(new OpenLayers.LonLat(<%= lon %>, <%= lat %>));
|
||||
function init() {
|
||||
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
|
||||
var zoom = <%= zoom %>;
|
||||
|
||||
var map = createMap("map");
|
||||
|
||||
map.setCenter(centre, zoom);
|
||||
setMapCenter(centre, zoom);
|
||||
|
||||
map.events.register("click", map, setLocation);
|
||||
}
|
||||
|
@ -54,8 +57,7 @@
|
|||
function setLocation( e ) {
|
||||
closeMapPopup();
|
||||
|
||||
var merc = map.getLonLatFromViewPortPx(e.xy);
|
||||
var lonlat = mercatorToLonLat(merc);
|
||||
var lonlat = getEventPosition(e);
|
||||
|
||||
document.getElementById('latitude').value = lonlat.lat;
|
||||
document.getElementById('longitude').value = lonlat.lon;
|
||||
|
@ -67,6 +69,11 @@
|
|||
marker = addMarkerToMap(merc, null, "Diary entry location");
|
||||
}
|
||||
|
||||
function openMap() {
|
||||
$("map").style.display = "block";
|
||||
$("usemap").style.display = "none";
|
||||
}
|
||||
|
||||
window.onload = init;
|
||||
// -->
|
||||
</script>
|
||||
|
|
2
app/views/diary_entry/no_such_user.rhtml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h2><%= h(@not_found_user) %></h2>
|
||||
<p>Sorry, there is no user with the name <%= @not_found_user -%>. Please check your spelling, or maybe the link you clicked is wrong.</p>
|
79
app/views/export/_start.rhtml
Normal file
|
@ -0,0 +1,79 @@
|
|||
<% form_tag :action => "finish" do %>
|
||||
|
||||
<p class="export_heading">Area to Export</p>
|
||||
|
||||
<div class="export_bounds">
|
||||
<%= text_field_tag('maxlat', nil, :size => 10, :class => "export_bound") %>
|
||||
<br/>
|
||||
<%= text_field_tag('minlon', nil, :size => 10, :class => "export_bound") %>
|
||||
<%= text_field_tag('maxlon', nil, :size => 10, :class => "export_bound") %>
|
||||
<br/>
|
||||
<%= text_field_tag('minlat', nil, :size => 10, :class => "export_bound") %>
|
||||
<p class="export_hint">
|
||||
<a id='drag_box' href="#" onclick="return startBox();">Manually select a different area</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="export_heading">Format to Export</p>
|
||||
|
||||
<div class="export_details">
|
||||
<p>
|
||||
<%= radio_button_tag("format", "osm") %> OpenStreetMap XML Data
|
||||
<br/>
|
||||
<%= radio_button_tag("format", "mapnik") %> Mapnik Image
|
||||
<br/>
|
||||
<%= radio_button_tag("format", "osmarender") %> Osmarender Image
|
||||
<br/>
|
||||
<%= radio_button_tag("format", "html") %> Embeddable HTML
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="export_osm">
|
||||
<p class="export_heading">Licence</p>
|
||||
|
||||
<div class="export_details">
|
||||
<p>OpenStreetMap data is licensed under the <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons Attribution-ShareAlike 2.0 license</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="export_mapnik">
|
||||
<p class="export_heading">Options</p>
|
||||
|
||||
<div class="export_details">
|
||||
<p>Format <%= select_tag("mapnik_format", options_for_select([["PNG", "png"], ["JPEG", "jpeg"], ["SVG", "svg"], ["PDF", "pdf"], ["Postscript", "ps"]], "png")) %></p>
|
||||
<p>Scale 1 : <%= text_field_tag("mapnik_scale", nil, :size => 8) %> <span class="export_hint">(max 1 : <span id="mapnik_max_scale"></span>)</span></p>
|
||||
<p>Image Size <span id="mapnik_image_width"></span> x <span id="mapnik_image_height"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="export_osmarender">
|
||||
<p class="export_heading">Options</p>
|
||||
|
||||
<div class="export_details">
|
||||
<p>Format <%= select_tag("osmarender_format", options_for_select([["PNG", "png"], ["JPEG", "jpeg"]], "png")) %></p>
|
||||
<p>Zoom <%= select_tag("osmarender_zoom", options_for_select([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])) %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="export_html">
|
||||
<p class="export_heading">Options</p>
|
||||
<div class="export_details">
|
||||
<p><a id="add_marker" href="#">Add a marker to the map</a></p>
|
||||
<p id="marker_inputs" style="display:none">
|
||||
Lat: <input type="text" id="marker_lat" size="9" />
|
||||
Lon: <input type="text" id="marker_lon" size="9" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="export_heading">Output</p>
|
||||
<div class="export_details">
|
||||
<p><input type="text" id="export_html_text" style="width:95%" /></p>
|
||||
<p>Paste HTML to embed in website</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="export_buttons">
|
||||
<p><%= submit_tag "Export", :id => "export_commit" %></p>
|
||||
</div>
|
||||
|
||||
<% end %>
|
352
app/views/export/start.rjs
Normal file
|
@ -0,0 +1,352 @@
|
|||
page.replace_html :sidebar_title, 'Export'
|
||||
page.replace_html :sidebar_content, :partial => 'start'
|
||||
page << <<EOJ
|
||||
var vectors;
|
||||
var box;
|
||||
var markerLayer;
|
||||
var markerControl;
|
||||
|
||||
function startExport() {
|
||||
vectors = new OpenLayers.Layer.Vector("Vector Layer", {
|
||||
displayInLayerSwitcher: false
|
||||
});
|
||||
map.addLayer(vectors);
|
||||
|
||||
box = new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.RegularPolygon, {
|
||||
handlerOptions: {
|
||||
sides: 4,
|
||||
snapAngle: 90,
|
||||
irregular: true,
|
||||
persist: true,
|
||||
callbacks: { done: endDrag }
|
||||
}
|
||||
});
|
||||
map.addControl(box);
|
||||
|
||||
map.events.register("moveend", map, mapMoved);
|
||||
map.events.register("changebaselayer", map, htmlUrlChanged);
|
||||
|
||||
openSidebar({ onclose: stopExport });
|
||||
|
||||
if (map.baseLayer.name == "Mapnik") {
|
||||
$("format_mapnik").checked = true;
|
||||
} else if (map.baseLayer.name == "Osmarender") {
|
||||
$("format_osmarender").checked = true;
|
||||
}
|
||||
|
||||
formatChanged();
|
||||
setBounds(map.getExtent());
|
||||
|
||||
$("viewanchor").className = "";
|
||||
$("exportanchor").className = "active";
|
||||
}
|
||||
|
||||
function stopExport() {
|
||||
$("viewanchor").className = "active";
|
||||
$("exportanchor").className = "";
|
||||
|
||||
clearBox();
|
||||
clearMarker();
|
||||
map.events.unregister("moveend", map, mapMoved);
|
||||
map.events.unregister("changebaselayer", map, htmlUrlChanged);
|
||||
map.removeLayer(vectors);
|
||||
}
|
||||
|
||||
function boundsChanged() {
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value,
|
||||
$("minlat").value,
|
||||
$("maxlon").value,
|
||||
$("maxlat").value);
|
||||
|
||||
bounds.transform(epsg4326, map.getProjectionObject());
|
||||
|
||||
map.events.unregister("moveend", map, mapMoved);
|
||||
map.zoomToExtent(bounds);
|
||||
|
||||
clearBox();
|
||||
drawBox(bounds);
|
||||
|
||||
validateControls();
|
||||
mapnikSizeChanged();
|
||||
}
|
||||
|
||||
$("maxlat").onchange = boundsChanged;
|
||||
$("minlon").onchange = boundsChanged;
|
||||
$("maxlon").onchange = boundsChanged;
|
||||
$("minlat").onchange = boundsChanged;
|
||||
|
||||
function startDrag() {
|
||||
$("drag_box").innerHTML='Drag a box on the map to select an area';
|
||||
|
||||
clearBox();
|
||||
box.activate();
|
||||
};
|
||||
|
||||
$("drag_box").onclick = startDrag;
|
||||
|
||||
function endDrag(bbox) {
|
||||
var bounds = bbox.getBounds();
|
||||
|
||||
map.events.unregister("moveend", map, mapMoved);
|
||||
setBounds(bounds);
|
||||
drawBox(bounds);
|
||||
box.deactivate();
|
||||
validateControls();
|
||||
|
||||
$("drag_box").innerHTML = "Manually select a different area";
|
||||
}
|
||||
|
||||
function startMarker() {
|
||||
$("add_marker").innerHTML='Click on the map to add a marker';
|
||||
|
||||
if (!markerLayer) {
|
||||
markerLayer = new OpenLayers.Layer.Vector("",{
|
||||
displayInLayerSwitcher: false,
|
||||
style: {
|
||||
externalGraphic: OpenLayers.Util.getImagesLocation() + "marker.png",
|
||||
graphicXOffset: -10.5,
|
||||
graphicYOffset: -25,
|
||||
graphicWidth: 21,
|
||||
graphicHeight: 25
|
||||
}
|
||||
});
|
||||
map.addLayer(markerLayer);
|
||||
|
||||
markerControl = new OpenLayers.Control.DrawFeature(markerLayer, OpenLayers.Handler.Point);
|
||||
map.addControl(markerControl);
|
||||
|
||||
markerLayer.events.on({ "featureadded": endMarker });
|
||||
}
|
||||
|
||||
markerLayer.destroyFeatures();
|
||||
markerControl.activate();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$("add_marker").onclick = startMarker;
|
||||
|
||||
function endMarker(event) {
|
||||
markerControl.deactivate();
|
||||
|
||||
$("add_marker").innerHTML = "Change marker position";
|
||||
$("marker_inputs").style.display = "block";
|
||||
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
|
||||
var geom = event.feature.geometry.clone().transform(epsg900913, epsg4326);
|
||||
|
||||
$("marker_lon").value = geom.x.toFixed(5);
|
||||
$("marker_lat").value = geom.y.toFixed(5);
|
||||
|
||||
htmlUrlChanged();
|
||||
}
|
||||
|
||||
function clearMarker() {
|
||||
$("marker_lon").value = "";
|
||||
$("marker_lat").value = "";
|
||||
$("marker_inputs").style.display = "none";
|
||||
$("add_marker").innerHTML = "Add a marker to the map";
|
||||
|
||||
if (markerLayer) {
|
||||
markerControl.destroy();
|
||||
markerLayer.destroy();
|
||||
markerLayer = null;
|
||||
markerControl = null;
|
||||
}
|
||||
}
|
||||
|
||||
function mapMoved() {
|
||||
setBounds(map.getExtent());
|
||||
validateControls();
|
||||
}
|
||||
|
||||
function setBounds(bounds) {
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var decimals = Math.pow(10, Math.floor(map.getZoom() / 3));
|
||||
|
||||
bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);
|
||||
|
||||
$("minlon").value = Math.round(bounds.left * decimals) / decimals;
|
||||
$("minlat").value = Math.round(bounds.bottom * decimals) / decimals;
|
||||
$("maxlon").value = Math.round(bounds.right * decimals) / decimals;
|
||||
$("maxlat").value = Math.round(bounds.top * decimals) / decimals;
|
||||
|
||||
mapnikSizeChanged();
|
||||
htmlUrlChanged();
|
||||
}
|
||||
|
||||
function clearBox() {
|
||||
vectors.destroyFeatures();
|
||||
}
|
||||
|
||||
function drawBox(bounds) {
|
||||
var feature = new OpenLayers.Feature.Vector(bounds.toGeometry());
|
||||
|
||||
vectors.addFeatures(feature);
|
||||
}
|
||||
|
||||
function validateControls() {
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
|
||||
|
||||
if (bounds.getWidth() * bounds.getHeight() > 0.25) {
|
||||
$("format_osm").disabled = true;
|
||||
$("format_osm").checked = false;
|
||||
$("export_osm").style.display = "none";
|
||||
} else {
|
||||
$("format_osm").disabled = false;
|
||||
}
|
||||
|
||||
var max_scale = maxMapnikScale();
|
||||
|
||||
if ($("format_mapnik").checked && $("mapnik_scale").value < max_scale) {
|
||||
$("export_commit").disabled = true;
|
||||
} else {
|
||||
$("export_commit").disabled = false;
|
||||
}
|
||||
|
||||
$("mapnik_max_scale").innerHTML = roundScale(max_scale);
|
||||
|
||||
var max_zoom = maxOsmarenderZoom();
|
||||
|
||||
for (var o = 0; o < $("osmarender_zoom").options.length; o++) {
|
||||
var option = $("osmarender_zoom").options[o];
|
||||
|
||||
if (option.value > max_zoom) {
|
||||
option.disabled = true;
|
||||
} else {
|
||||
option.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($("osmarender_zoom").options.selectedIndex + 4 > max_zoom) {
|
||||
$("osmarender_zoom").options.selectedIndex = max_zoom - 4;
|
||||
}
|
||||
}
|
||||
|
||||
function htmlUrlChanged() {
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
|
||||
var layerName = map.baseLayer.name.toLowerCase();
|
||||
var url = "http://#{SERVER_URL}/export/embed.html?bbox=" + bounds.toBBOX() + "&layer=" + layerName;
|
||||
var markerUrl = "";
|
||||
|
||||
if ($("marker_lat").value && $("marker_lon").value) {
|
||||
markerUrl = "&mlat=" + $("marker_lat").value + "&mlon=" + $("marker_lon").value;
|
||||
url += "&marker=" + $("marker_lat").value + "," + $("marker_lon").value;
|
||||
}
|
||||
|
||||
var html = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+url+'" style="border: 1px solid black"></iframe>';
|
||||
|
||||
// Create "larger map" link
|
||||
var center = bounds.getCenterLonLat();
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
|
||||
|
||||
bounds.transform(epsg4326, epsg900913);
|
||||
var zoom = map.getZoomForExtent(bounds);
|
||||
|
||||
html += '<br /><small><a href="http://#{SERVER_URL}/?lat='+center.lat+'&lon='+center.lon+'&zoom='+zoom+markerUrl+'">View Larger Map</a></small>';
|
||||
|
||||
$("export_html_text").value = html;
|
||||
|
||||
if ($("format_html").checked) {
|
||||
$("export_html_text").select();
|
||||
}
|
||||
}
|
||||
|
||||
function formatChanged() {
|
||||
$("export_commit").style.display = "inline";
|
||||
|
||||
if ($("format_osm").checked) {
|
||||
$("export_osm").style.display = "inline";
|
||||
} else {
|
||||
$("export_osm").style.display = "none";
|
||||
}
|
||||
|
||||
if ($("format_mapnik").checked) {
|
||||
$("mapnik_scale").value = roundScale(map.getScale());
|
||||
$("export_mapnik").style.display = "inline";
|
||||
} else {
|
||||
$("export_mapnik").style.display = "none";
|
||||
}
|
||||
|
||||
if ($("format_osmarender").checked) {
|
||||
var zoom = Math.min(map.getZoom(), maxOsmarenderZoom());
|
||||
|
||||
$("osmarender_zoom").options.selectedIndex = zoom - 4;
|
||||
$("export_osmarender").style.display = "inline";
|
||||
} else {
|
||||
$("export_osmarender").style.display = "none";
|
||||
}
|
||||
|
||||
if ($("format_html").checked) {
|
||||
$("export_html").style.display = "inline";
|
||||
$("export_commit").style.display = "none";
|
||||
$("export_html_text").select();
|
||||
} else {
|
||||
$("export_html").style.display = "none";
|
||||
clearMarker();
|
||||
}
|
||||
|
||||
validateControls();
|
||||
}
|
||||
|
||||
$("format_osm").onclick = formatChanged;
|
||||
$("format_mapnik").onclick = formatChanged;
|
||||
$("format_osmarender").onclick = formatChanged;
|
||||
$("format_html").onclick = formatChanged;
|
||||
|
||||
function maxMapnikScale() {
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
|
||||
|
||||
bounds.transform(epsg4326, epsg900913);
|
||||
|
||||
return Math.floor(Math.sqrt(bounds.getWidth() * bounds.getHeight() / 0.3136));
|
||||
}
|
||||
|
||||
function mapnikImageSize(scale) {
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
|
||||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
|
||||
|
||||
bounds.transform(epsg4326, epsg900913);
|
||||
|
||||
return new OpenLayers.Size(Math.round(bounds.getWidth() / scale / 0.00028),
|
||||
Math.round(bounds.getHeight() / scale / 0.00028));
|
||||
}
|
||||
|
||||
function maxOsmarenderZoom() {
|
||||
var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
|
||||
var xzoom = Math.LOG2E * Math.log(2000 * 1.40625 / bounds.getWidth());
|
||||
var ymin = bounds.bottom * Math.PI / 180;
|
||||
var ymax = bounds.top * Math.PI / 180;
|
||||
var yzoom = Math.LOG2E * (Math.log(2000 * 2 * Math.PI) - Math.log(Math.log((Math.tan(ymax) + 1 / Math.cos(ymax)) / (Math.tan(ymin) + 1 / Math.cos(ymin)))))
|
||||
|
||||
return Math.floor(Math.min(xzoom, yzoom));
|
||||
}
|
||||
|
||||
function roundScale(scale) {
|
||||
var precision = 5 * Math.pow(10, Math.floor(Math.LOG10E * Math.log(scale)) - 2);
|
||||
|
||||
return precision * Math.ceil(scale / precision);
|
||||
}
|
||||
|
||||
function mapnikSizeChanged() {
|
||||
var size = mapnikImageSize($("mapnik_scale").value);
|
||||
|
||||
$("mapnik_image_width").innerHTML = size.w;
|
||||
$("mapnik_image_height").innerHTML = size.h;
|
||||
}
|
||||
|
||||
function mapnikScaleChanged() {
|
||||
mapnikSizeChanged();
|
||||
validateControls();
|
||||
}
|
||||
|
||||
$("mapnik_scale").onchange = mapnikScaleChanged;
|
||||
|
||||
startExport();
|
||||
EOJ
|
|
@ -36,15 +36,23 @@
|
|||
<%
|
||||
viewclass = ''
|
||||
editclass = ''
|
||||
exportclass = ''
|
||||
traceclass = ''
|
||||
viewclass = 'active' if params['controller'] == 'site' and params['action'] == 'index'
|
||||
editclass = 'active' if params['controller'] == 'site' and params['action'] == 'edit'
|
||||
editclass = 'active' if params['controller'] == 'campaign'
|
||||
exportclass = 'active' if params['controller'] == 'site' and params['action'] == 'export'
|
||||
traceclass = 'active' if params['controller'] == 'trace'
|
||||
diaryclass = 'active' if params['controller'] == 'diary_entry'
|
||||
%>
|
||||
<li><%= link_to 'View', {:controller => 'site', :action => 'index'}, {:id => 'viewanchor', :title => 'view maps', :class => viewclass } %></li>
|
||||
<li><%= link_to 'Edit', {:controller => 'site', :action => 'edit'}, {:id => 'editanchor', :title => 'edit maps', :class => editclass } %></li>
|
||||
<li><%= link_to 'GPS traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass } %></li>
|
||||
<li><%= link_to 'View', {:controller => 'site', :action => 'index'}, {:id => 'viewanchor', :title => 'view maps', :class => viewclass} %></li>
|
||||
<li><%= link_to 'Edit', {:controller => 'site', :action => 'edit'}, {:id => 'editanchor', :title => 'edit maps', :class => editclass} %></li>
|
||||
<% if params['controller'] == 'site' and (params['action'] == 'index' or params['action'] == 'export') %>
|
||||
<li><%= link_to_remote 'Export', {:url => {:controller => 'export', :action => 'start'}}, {:id => 'exportanchor', :title => 'export map data', :class => exportclass, :href => url_for(:controller => 'site', :action => 'export')} %></li>
|
||||
<% else %>
|
||||
<li><%= link_to 'Export', {:controller => 'site', :action => 'export'}, {:id => 'exportanchor', :title => 'export map data', :class => exportclass} %></li>
|
||||
<% end %>
|
||||
<li><%= link_to 'GPS Traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass} %></li>
|
||||
<li><%= link_to 'User Diaries', {:controller => 'diary_entry', :action => 'list'}, {:id => 'diaryanchor', :title => 'view user diaries', :class => diaryclass} %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -82,12 +90,17 @@
|
|||
|
||||
<div id="left_menu" class="left_menu">
|
||||
<a href="http://wiki.openstreetmap.org">Help & Wiki</a><br />
|
||||
<%= link_to "Users' diaries", {:controller => 'diary_entry', :action => 'list', :display_name => nil} %><br />
|
||||
<a href="http://www.opengeodata.org/">News blog</a><br />
|
||||
<a href="http://wiki.openstreetmap.org/index.php/Merchandise">Shop</a><br />
|
||||
<%= yield :left_menu %>
|
||||
</div>
|
||||
|
||||
<div id="sotm" class="left_menu">
|
||||
<div id="sotminfo">
|
||||
Come to the second OpenStreetMap Conference, <a href="http://www.stateofthemap.org">The State of the Map</a>: 12th-13th July 2008, Limerick, Ireland.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= yield :optionals %>
|
||||
<div id="cclogo">
|
||||
<center>
|
||||
|
|
|
@ -10,4 +10,6 @@
|
|||
<td><%= button_to 'Mark as read', :controller => 'message', :action => 'mark', :message_id => message_summary.id, :mark => 'read' %></td>
|
||||
<% end %>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'reply', :message_id => message_summary.id %></td>
|
||||
<td><%= button_to 'Delete', :controller => 'message', :action => 'destroy', :message_id => message_summary.id %></td>
|
||||
|
||||
</tr>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<tr>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'reply', :message_id => @message.id %></td>
|
||||
<td><%= button_to 'Mark as unread', :controller => 'message', :action => 'mark', :message_id => @message.id, :mark => 'unread' %></td>
|
||||
<td><%= button_to 'Delete', :controller => 'message', :action => 'destroy', :message_id => @message.id %></td>
|
||||
<td><%= link_to 'Back to inbox', :controller => 'message', :action => 'inbox', :display_name => @user.display_name %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
14
app/views/notifier/_gpx_description.rhtml
Normal file
|
@ -0,0 +1,14 @@
|
|||
Hi,
|
||||
|
||||
It looks like your GPX file
|
||||
|
||||
<%= @trace_name %>
|
||||
|
||||
with the description
|
||||
|
||||
<%= @trace_description %>
|
||||
<% if @trace_tags.length>0 %>
|
||||
and the following tags:
|
||||
<% @trace_tags.each do |tag| %>
|
||||
<%= tag.tag.rstrip %><% end %><% else %>
|
||||
and no tags.<% end %>
|
|
@ -1,9 +1,4 @@
|
|||
Hi,
|
||||
|
||||
It looks like your GPX file
|
||||
|
||||
<%= @trace_name %>
|
||||
|
||||
<%= render :partial => "gpx_description" %>
|
||||
failed to import. Here's the error:
|
||||
|
||||
<%= @error %>
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
Hi,
|
||||
|
||||
It looks like your GPX file
|
||||
|
||||
<%= @trace_name %>
|
||||
|
||||
<%= render :partial => "gpx_description" %>
|
||||
loaded successfully with <%= @trace_points %> out of a possible
|
||||
<%= @possible_points %> points.
|
||||
|
|
|
@ -6,3 +6,9 @@
|
|||
<p>If this is you, please click the link below to confirm that account.</p>
|
||||
|
||||
<p><a href="<%= @url %>"><%= @url %></a></p>
|
||||
|
||||
<p>You may also want to <a href="http://wiki.openstreetmap.org/index.php?title=Special:Userlogin&type=signup&returnto=Main_Page">sign up to the OpenStreetMap wiki</a>.</p>
|
||||
|
||||
<p>It is recommended that you create a user wiki page, which includes category tags noting where you are, such as <a href="http://wiki.openstreetmap.org/index.php/Category:Users_in_London">[[Category:Users_in_London]]</a>.</p>
|
||||
|
||||
<p>A list of current users in categories, based on where in the world they are, is available from <a href="http://wiki.openstreetmap.org/index.php/Category:Users_by_geographical_region">Category:Users_by_geographical_region</a>.</p>
|
||||
|
|
|
@ -6,3 +6,15 @@ Someone (hopefully you) would like to create an account over at
|
|||
If this is you, please click the link below to confirm that account.
|
||||
|
||||
<%= @url %>
|
||||
|
||||
You may also want to sign up to the OpenStreetMap wiki at:
|
||||
|
||||
http://wiki.openstreetmap.org/index.php?title=Special:Userlogin&type=signup&returnto=Main_Page
|
||||
|
||||
It is recommended that you create a user wiki page, which includes
|
||||
category tags noting where you are, such as [[Category:Users_in_London]].
|
||||
|
||||
A list of current users in categories, based on where in the world
|
||||
they are, is available from:
|
||||
|
||||
http://wiki.openstreetmap.org/index.php/Category:Users_by_geographical_region
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
else { var imgname = 'keymapnik13.png'; }
|
||||
|
||||
updateSidebar("Map key", "<p><img src='images/"+imgname+"' /></p>");
|
||||
openSidebar("210px");
|
||||
openSidebar({ width: "210px" });
|
||||
}
|
||||
|
||||
function updateKey() {
|
||||
|
|
|
@ -11,19 +11,35 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function openSidebar() {
|
||||
if (arguments.length) { $("sidebar").style.width = arguments[0]; }
|
||||
var onclose;
|
||||
|
||||
function openSidebar(options) {
|
||||
options = options || {};
|
||||
|
||||
if (onclose) {
|
||||
onclose();
|
||||
onclose = null;
|
||||
}
|
||||
|
||||
if (options.width) { $("sidebar").style.width = options.width; }
|
||||
else { $("sidebar").style.width = "30%"; }
|
||||
|
||||
$("sidebar").style.display = "block";
|
||||
|
||||
<%= onopen %>
|
||||
|
||||
onclose = options.onclose;
|
||||
}
|
||||
|
||||
function closeSidebar() {
|
||||
$("sidebar").style.display = "none";
|
||||
|
||||
<%= onclose %>
|
||||
|
||||
if (onclose) {
|
||||
onclose();
|
||||
onclose = null;
|
||||
}
|
||||
}
|
||||
|
||||
function updateSidebar(title, content) {
|
||||
|
|
|
@ -24,29 +24,27 @@
|
|||
<% session[:token] = @user.tokens.create.token unless session[:token] %>
|
||||
|
||||
<% if params['mlon'] and params['mlat'] %>
|
||||
<% lon = h(params['mlon']) %>
|
||||
<% lat = h(params['mlat']) %>
|
||||
<% zoom = h(params['zoom'] || '14') %>
|
||||
<% lon = h(params['mlon']) %>
|
||||
<% lat = h(params['mlat']) %>
|
||||
<% zoom = h(params['zoom'] || '14') %>
|
||||
<% elsif @user and params['lon'].nil? and params['lat'].nil? and params['gpx'].nil? %>
|
||||
<% lon = @user.home_lon %>
|
||||
<% lat = @user.home_lat %>
|
||||
<% zoom = '14' %>
|
||||
<% elsif params['gpx'].nil? %>
|
||||
<% lon = h(params['lon'] || '-0.1') %>
|
||||
<% lat = h(params['lat'] || '51.5') %>
|
||||
<% zoom = h(params['zoom'] || '14') %>
|
||||
<% lon = @user.home_lon %>
|
||||
<% lat = @user.home_lat %>
|
||||
<% zoom = '14' %>
|
||||
<% else %>
|
||||
<% lon = nil %>
|
||||
<% lat = nil %>
|
||||
<% zoom = '14' %>
|
||||
<% lon = h(params['lon'] || 'null') %>
|
||||
<% lat = h(params['lat'] || 'null') %>
|
||||
<% zoom = h(params['zoom'] || '14') %>
|
||||
<% end %>
|
||||
|
||||
<div id="map">You need a Flash player to use Potlatch, the
|
||||
<div id="map">
|
||||
You need a Flash player to use Potlatch, the
|
||||
OpenStreetMap Flash editor. You can <a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">download Flash Player from Adobe.com</a>.
|
||||
|
||||
<a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
|
||||
for editing OpenStreetMap.
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag 'swfobject.js' %>
|
||||
<script type="text/javascript" defer="defer">
|
||||
var brokenContentSize = $("content").offsetWidth == 0;
|
||||
|
@ -68,7 +66,7 @@
|
|||
if (lat) { fo.addVariable('lat',lat); }
|
||||
if (lon) { fo.addVariable('long',lon); }
|
||||
<% if params['gpx'] %>
|
||||
fo.addVariable('gpx','<%= h(params['gpx']) + "/data.xml" %>');
|
||||
fo.addVariable('gpx','<%= h(params['gpx']) %>');
|
||||
<% end %>
|
||||
fo.write("map");
|
||||
}
|
||||
|
|
|
@ -87,20 +87,18 @@ by the OpenStreetMap project and it's contributors.
|
|||
map = createMap("map");
|
||||
|
||||
<% if bbox %>
|
||||
var min = lonLatToMercator(new OpenLayers.LonLat(<%= minlon %>, <%= minlat %>));
|
||||
var max = lonLatToMercator(new OpenLayers.LonLat(<%= maxlon %>, <%= maxlat %>));
|
||||
var bbox = new OpenLayers.Bounds(min.lon, min.lat, max.lon, max.lat);
|
||||
var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
|
||||
|
||||
map.zoomToExtent(bbox);
|
||||
setMapExtent(bbox);
|
||||
<% else %>
|
||||
var centre = lonLatToMercator(new OpenLayers.LonLat(<%= lon %>, <%= lat %>));
|
||||
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
|
||||
var zoom = <%= zoom %>;
|
||||
|
||||
<% if params['scale'] and params['scale'].length > 0 then %>
|
||||
zoom = scaleToZoom(<%= params['scale'].to_f() %>);
|
||||
<% end %>
|
||||
|
||||
map.setCenter(centre, zoom);
|
||||
setMapCenter(centre, zoom);
|
||||
<% end %>
|
||||
|
||||
<% if layers %>
|
||||
|
@ -108,7 +106,7 @@ by the OpenStreetMap project and it's contributors.
|
|||
<% end %>
|
||||
|
||||
<% if marker %>
|
||||
marker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)));
|
||||
marker = addMarkerToMap(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>));
|
||||
<% end %>
|
||||
|
||||
map.events.register("zoomend", map, updateKey);
|
||||
|
@ -121,13 +119,13 @@ by the OpenStreetMap project and it's contributors.
|
|||
}
|
||||
|
||||
function getPosition() {
|
||||
return mercatorToLonLat(map.getCenter());
|
||||
return getMapCenter();
|
||||
}
|
||||
|
||||
function setPosition(lat, lon, zoom) {
|
||||
var centre = lonLatToMercator(new OpenLayers.LonLat(lon, lat));
|
||||
var centre = new OpenLayers.LonLat(lon, lat);
|
||||
|
||||
map.setCenter(centre, zoom);
|
||||
setMapCenter(centre, zoom);
|
||||
|
||||
if (marker)
|
||||
removeMarkerFromMap(marker);
|
||||
|
@ -136,7 +134,7 @@ by the OpenStreetMap project and it's contributors.
|
|||
}
|
||||
|
||||
function updateLocation() {
|
||||
var lonlat = mercatorToLonLat(map.getCenter());
|
||||
var lonlat = getMapCenter();
|
||||
var zoom = map.getZoom();
|
||||
var layers = getMapLayers();
|
||||
|
||||
|
@ -182,5 +180,9 @@ by the OpenStreetMap project and it's contributors.
|
|||
|
||||
window.onload = handleResize;
|
||||
window.onresize = handleResize;
|
||||
|
||||
<% if params['action'] == 'export' %>
|
||||
<%= remote_function :url => { :controller => 'export', :action => 'start' } %>
|
||||
<% end %>
|
||||
// -->
|
||||
</script>
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
<h1><%= h(@title) %></h1>
|
||||
|
||||
<span class="rsssmall"><a href="<%= url_for :action => 'georss', :display_name => @display_name, :tag => @tag %>"><img src="/images/RSS.gif" border="0" alt="RSS" /></a></span>
|
||||
<% if @user.nil? or @display_name.nil? or @user.display_name != @display_name %>
|
||||
| <%= link_to 'See just your traces, or upload a trace', :action => 'mine' %>
|
||||
<% end %>
|
||||
<% if @tag or @display_name %>
|
||||
| <%= link_to 'See all traces', :controller => 'trace', :action => 'list' %>
|
||||
<% end %>
|
||||
<% if @tag and @user and @user.display_name == @display_name %>
|
||||
| <%= link_to 'See all your traces', :controller => 'trace', :action => 'mine' %>
|
||||
<% end %>
|
||||
<%= auto_discovery_link_tag :atom, :action => 'georss', :display_name => @display_name, :tag => @tag %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<p>
|
||||
<%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %>
|
||||
<% if @user.nil? or @display_name.nil? or @user.display_name != @display_name %>
|
||||
| <%= link_to 'See just your traces, or upload a trace', :action => 'mine' %>
|
||||
<% end %>
|
||||
<% if @tag or @display_name %>
|
||||
| <%= link_to 'See all traces', :controller => 'trace', :action => 'list' %>
|
||||
<% end %>
|
||||
<% if @tag and @user and @user.display_name == @display_name %>
|
||||
| <%= link_to 'See all your traces', :controller => 'trace', :action => 'mine' %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<% if @user and @user.traces.count(:conditions => "inserted=0") > 4 %>
|
||||
<p>
|
||||
You have <%= @user.traces.count(:conditions => "inserted=0") %> traces
|
||||
waiting for upload. Please consider waiting for these to finish before
|
||||
uploading any more, so as not to block the queue for other users.
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
var marker;
|
||||
|
||||
function init(){
|
||||
var centre = lonLatToMercator(new OpenLayers.LonLat(<%= lon %>, <%= lat %>));
|
||||
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
|
||||
var zoom = <%= zoom %>;
|
||||
|
||||
<% if params['scale'] and params['scale'].length > 0 then %>
|
||||
|
@ -42,10 +42,10 @@
|
|||
|
||||
var map = createMap("map");
|
||||
|
||||
map.setCenter(centre, zoom);
|
||||
setMapCenter(centre, zoom);
|
||||
|
||||
<% if marker %>
|
||||
marker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)), null, "Your location");
|
||||
marker = addMarkerToMap(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>), null, "Your location");
|
||||
<% end %>
|
||||
|
||||
var near_icon = OpenLayers.Marker.defaultIcon();
|
||||
|
@ -53,7 +53,7 @@
|
|||
var i = nearest.length;
|
||||
while( i-- ) {
|
||||
var description = 'Nearby mapper: <a href="/user/'+nearest[i].display_name+'">'+nearest[i].display_name+'</a>'
|
||||
var nearmarker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(nearest[i].home_lon, nearest[i].home_lat)), near_icon.clone(), description);
|
||||
var nearmarker = addMarkerToMap(new OpenLayers.LonLat(nearest[i].home_lon, nearest[i].home_lat), near_icon.clone(), description);
|
||||
}
|
||||
|
||||
map.events.register("click", map, setHome);
|
||||
|
@ -63,8 +63,7 @@
|
|||
closeMapPopup();
|
||||
|
||||
if (document.getElementById('updatehome').checked) {
|
||||
var merc = map.getLonLatFromViewPortPx(e.xy);
|
||||
var lonlat = mercatorToLonLat(merc);
|
||||
var lonlat = getEventPosition(e);
|
||||
|
||||
document.getElementById('homerow').className = '';
|
||||
document.getElementById('home_lat').value = lonlat.lat;
|
||||
|
@ -74,7 +73,7 @@
|
|||
removeMarkerFromMap(marker);
|
||||
}
|
||||
|
||||
marker = addMarkerToMap(merc, null, "Your location");
|
||||
marker = addMarkerToMap(lonlat, null, "Your location");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
2
app/views/user/no_such_user.rhtml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h2><%= h(@not_found_user) %></h2>
|
||||
<p>Sorry, there is no user with the name <%= @not_found_user -%>. Please check your spelling, or maybe the link you clicked is wrong.</p>
|
|
@ -83,9 +83,10 @@ compress.filetype = (
|
|||
# Set expiry for static content
|
||||
#
|
||||
expire.url = (
|
||||
"/export/" => "access 7 days",
|
||||
"/images/" => "access 10 years",
|
||||
"/javascripts/" => "access 10 years",
|
||||
"/openlayers/" => "access 10 years",
|
||||
"/openlayers/" => "access 7 days",
|
||||
"/stylesheets/" => "access 10 years"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Potlatch autocomplete values
|
||||
# each line should be: key / way|point|POI (tab) list_of_values
|
||||
# '-' indicates no autocomplete for values
|
||||
highway/way motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary,tertiary,unclassified,residential,service,bridleway,cycleway,footway,pedestrian,steps
|
||||
highway/point mini_roundabout,traffic_signals,crossing,gate,stile,cattle_grid,toll_booth,incline,viaduct,motorway_junction,services,ford,bus_stop
|
||||
highway/way motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary,tertiary,unclassified,residential,service,bridleway,cycleway,footway,pedestrian,steps,living_street,track
|
||||
highway/point mini_roundabout,traffic_signals,crossing,gate,stile,cattle_grid,toll_booth,incline,viaduct,motorway_junction,services,ford,bus_stop,turning_circle
|
||||
junction/way roundabout
|
||||
cycleway/way lane,track,opposite_lane,opposite_track,opposite
|
||||
waterway/way river,canal,stream,drain,dock
|
||||
waterway/way river,canal,stream,drain,dock,riverbank
|
||||
waterway/point lock_gate,lock,turning_point,aqueduct,boatyard,water_point,waste_disposal,mooring,weir
|
||||
waterway/POI boatyard,water_point,waste_disposal,mooring
|
||||
railway/way rail,tram,light_rail,subway,preserved,disused,abandoned,narrow_gauge,monorail
|
||||
|
@ -20,12 +20,12 @@ man_made/point works,beacon,survey_point,power_wind,power_hydro,power_fossil,pow
|
|||
man_made/way reservoir_covered,pier
|
||||
leisure/POI sports_centre,golf_course,stadium,marina,track,pitch,water_park,fishing,nature_reserve,park,playground,garden,common,slipway
|
||||
leisure/way sports_centre,golf_course,stadium,marina,track,pitch,water_park,fishing,nature_reserve,park,playground,garden,common
|
||||
amenity/POI pub,biergarten,cafe,nightclub,restaurant,fast_food,parking,bicycle_parking,bicycle_rental,car_rental,car_shasring,fuel,telephone,toilets,recycling,public_building,place_of_worship,grave_yard,post_office,post_box,school,university,college,pharmacy,hospital,library,police,fire_station,bus_station,theatre,cinema,arts_centre,courthouse,prison,bank,bureau_de_change,atm,town_hall
|
||||
amenity/POI pub,biergarten,cafe,nightclub,restaurant,fast_food,parking,bicycle_parking,bicycle_rental,car_rental,car_sharing,fuel,telephone,toilets,recycling,public_building,place_of_worship,grave_yard,post_office,post_box,school,university,college,pharmacy,hospital,library,police,fire_station,bus_station,theatre,cinema,arts_centre,courthouse,prison,bank,bureau_de_change,atm,town_hall
|
||||
amenity/way parking,bicycle_parking,car_rental,car_sharing,public_building,grave_yard,school,university,college,hospital,town_hall
|
||||
shop/POI supermarket,convenience,bicycle,outdoor
|
||||
shop/way supermarket
|
||||
tourism/POI information,camp_site,caravan_site,caravan_site,picnic_site,viewpoint,theme_park,hotel,motel,guest_house,hostel,attraction,zoo
|
||||
tourism/way camp_site,caravan_site,picnic_site,theme_parkattraction,zoo
|
||||
tourism/way camp_site,caravan_site,picnic_site,theme_park,attraction,zoo
|
||||
historic/POI castle,monument,memorial,museum,archaeological_site,icon,ruins
|
||||
historic/way archaeological_site,ruins
|
||||
landuse/POI farm,quarry,landfill,basin,reservoir,forest,allotments,residential,retail,commercial,industrial,brownfield,greenfield,cemetery,village_green,recreation_ground
|
||||
|
|
|
@ -3,9 +3,10 @@ motorway: highway=motorway,ref=(type road number)
|
|||
trunk road: highway=trunk,ref=(type road number),name=(type road name)
|
||||
primary road: highway=primary,ref=(type road number),name=(type road name)
|
||||
secondary road: highway=secondary,ref=(type road number),name=(type road name)
|
||||
tertiary road: highway=tertiary,ref=,name=(type road name)
|
||||
residential road: highway=residential,ref=,name=(type road name)
|
||||
tertiary road: highway=tertiary,ref=(type road number),name=(type road name)
|
||||
unclassified road: highway=unclassified,ref=,name=(type road name)
|
||||
residential road: highway=residential,ref=,name=(type road name)
|
||||
service road: highway=service,ref=,name=
|
||||
|
||||
way/footway
|
||||
footpath: highway=footway,foot=yes
|
||||
|
|
|
@ -42,7 +42,9 @@ ActionController::Routing::Routes.draw do |map|
|
|||
|
||||
map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
|
||||
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
|
||||
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
|
||||
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
|
||||
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
|
||||
map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
|
||||
|
||||
map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
|
||||
|
@ -57,13 +59,21 @@ ActionController::Routing::Routes.draw do |map|
|
|||
# web site
|
||||
|
||||
map.connect '/', :controller => 'site', :action => 'index'
|
||||
map.connect '/edit', :controller => 'site', :action => 'edit'
|
||||
map.connect '/export', :controller => 'site', :action => 'export'
|
||||
map.connect '/login', :controller => 'user', :action => 'login'
|
||||
map.connect '/logout', :controller => 'user', :action => 'logout'
|
||||
map.connect '/user/new', :controller => 'user', :action => 'new'
|
||||
map.connect '/user/save', :controller => 'user', :action => 'save'
|
||||
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
|
||||
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
|
||||
map.connect '/user/reset_password', :controller => 'user', :action => 'reset_password'
|
||||
map.connect '/user/upload_image', :controller => 'user', :action => 'upload_image'
|
||||
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
|
||||
map.connect '/user/upload-image', :controller => 'user', :action => 'upload_image'
|
||||
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
|
||||
|
||||
map.connect '/index.html', :controller => 'site', :action => 'index'
|
||||
map.connect '/edit.html', :controller => 'site', :action => 'edit'
|
||||
map.connect '/export.html', :controller => 'site', :action => 'export'
|
||||
map.connect '/search.html', :controller => 'way_tag', :action => 'search'
|
||||
map.connect '/login.html', :controller => 'user', :action => 'login'
|
||||
map.connect '/logout.html', :controller => 'user', :action => 'logout'
|
||||
|
@ -121,6 +131,10 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
|
||||
map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
|
||||
|
||||
# export
|
||||
map.connect '/export/start', :controller => 'export', :action => 'start'
|
||||
map.connect '/export/finish', :controller => 'export', :action => 'finish'
|
||||
|
||||
# messages
|
||||
|
||||
map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
|
||||
|
@ -129,8 +143,9 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
|
||||
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
|
||||
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
|
||||
map.connect '/message/delete/:message_id', :controller => 'message', :action => 'destroy'
|
||||
|
||||
# fall through
|
||||
map.connect ':controller/:id/:action'
|
||||
map.connect ':controller/:id/:action'
|
||||
map.connect ':controller/:action'
|
||||
end
|
||||
|
|
12
db/migrate/012_add_user_preference_id.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class AddUserPreferenceId < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT"
|
||||
|
||||
add_index "user_preferences", ["id"], :name => "user_preferences_id_idx"
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index 'user_preferences', 'id'
|
||||
remove_column 'user_preferences', 'id'
|
||||
end
|
||||
end
|
72
lib/bounding_box.rb
Normal file
|
@ -0,0 +1,72 @@
|
|||
class BoundingBox
|
||||
def initialize(min_lon, min_lat, max_lon, max_lat)
|
||||
@bbox = [min_lon.to_f, min_lat.to_f, max_lon.to_f, max_lat.to_f]
|
||||
end
|
||||
|
||||
def self.from_s(s)
|
||||
BoundingBox.new(s.split(/,/))
|
||||
end
|
||||
|
||||
def min_lon
|
||||
@bbox[0]
|
||||
end
|
||||
|
||||
def min_lon=(min_lon)
|
||||
@bbox[0] = min_lon
|
||||
end
|
||||
|
||||
def min_lat
|
||||
@bbox[1]
|
||||
end
|
||||
|
||||
def min_lat=(min_lat)
|
||||
@bbox[1] = min_lat
|
||||
end
|
||||
|
||||
def max_lon
|
||||
@bbox[2]
|
||||
end
|
||||
|
||||
def max_lon=(max_lon)
|
||||
@bbox[2] = max_lon
|
||||
end
|
||||
|
||||
def max_lat
|
||||
@bbox[3]
|
||||
end
|
||||
|
||||
def max_lat=(max_lat)
|
||||
@bbox[3] = max_lat
|
||||
end
|
||||
|
||||
def centre_lon
|
||||
(@bbox[0] + @bbox[2]) / 2.0
|
||||
end
|
||||
|
||||
def centre_lat
|
||||
(@bbox[1] + @bbox[3]) / 2.0
|
||||
end
|
||||
|
||||
def width
|
||||
@bbox[2] - @bbox[0]
|
||||
end
|
||||
|
||||
def height
|
||||
@bbox[3] - @bbox[1]
|
||||
end
|
||||
|
||||
def slippy_width(zoom)
|
||||
width * 256.0 * 2.0 ** zoom / 360.0
|
||||
end
|
||||
|
||||
def slippy_height(zoom)
|
||||
min = min_lat * Math::PI / 180.0
|
||||
max = max_lat * Math::PI / 180.0
|
||||
|
||||
Math.log((Math.tan(max) + 1.0 / Math.cos(max)) / (Math.tan(min) + 1.0 / Math.cos(min))) * 128.0 * 2.0 ** zoom / Math::PI
|
||||
end
|
||||
|
||||
def to_s
|
||||
return @bbox.join(",")
|
||||
end
|
||||
end
|
|
@ -23,14 +23,14 @@ while(true) do
|
|||
if gpx.actual_points > 0
|
||||
Notifier::deliver_gpx_success(trace, gpx.actual_points)
|
||||
else
|
||||
trace.destroy
|
||||
Notifier::deliver_gpx_failure(trace, '0 points parsed ok. Do they all have lat,lng,alt,timestamp?')
|
||||
trace.destroy
|
||||
end
|
||||
rescue Exception => ex
|
||||
logger.info ex.to_s
|
||||
ex.backtrace.each {|l| logger.info l }
|
||||
trace.destroy
|
||||
Notifier::deliver_gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n"))
|
||||
trace.destroy
|
||||
end
|
||||
|
||||
Signal.trap("TERM", "DEFAULT")
|
||||
|
|
75
public/export/embed.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.olControlAttribution {
|
||||
bottom: 3px!important;
|
||||
}
|
||||
</style>
|
||||
<script src="http://openstreetmap.org/openlayers/OpenLayers.js"></script>
|
||||
<script src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
function init(){
|
||||
map = new OpenLayers.Map ("map", {
|
||||
controls: [
|
||||
new OpenLayers.Control.Attribution(),
|
||||
new OpenLayers.Control.Navigation()
|
||||
],
|
||||
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
|
||||
20037508.34,20037508.34),
|
||||
numZoomLevels: 20,
|
||||
maxResolution: 156543.0339,
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326"),
|
||||
units: 'm',
|
||||
projection: new OpenLayers.Projection("EPSG:900913")
|
||||
});
|
||||
|
||||
var attribution = 'Data by <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>';
|
||||
var args = OpenLayers.Util.getParameters();
|
||||
if (!args.layer || args.layer == "mapnik") {
|
||||
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
|
||||
displayOutsideMaxExtent: true,
|
||||
wrapDateLine: true,
|
||||
attribution: attribution
|
||||
});
|
||||
map.addLayer(mapnik);
|
||||
} else {
|
||||
var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
|
||||
displayOutsideMaxExtent: true,
|
||||
wrapDateLine: true,
|
||||
attribution: attribution
|
||||
});
|
||||
map.addLayer(osmarender);
|
||||
}
|
||||
|
||||
if (args.marker) {
|
||||
var markers = new OpenLayers.Layer.Markers();
|
||||
map.addLayer(markers);
|
||||
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(args.marker[1], args.marker[0]).transform(map.displayProjection, map.getProjectionObject())));
|
||||
map.marker = true;
|
||||
}
|
||||
|
||||
if (args.bbox) {
|
||||
var bounds = OpenLayers.Bounds.fromArray(args.bbox).transform(map.displayProjection, map.getProjectionObject());
|
||||
map.zoomToExtent(bounds)
|
||||
} else {
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
|
||||
var size = map.getSize();
|
||||
if (size.h > 320) {
|
||||
map.addControl(new OpenLayers.Control.PanZoomBar());
|
||||
} else {
|
||||
map.addControl(new OpenLayers.Control.PanZoom());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +1,4 @@
|
|||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var map;
|
||||
var markers;
|
||||
var popup;
|
||||
|
@ -5,34 +6,48 @@ var popup;
|
|||
OpenLayers._getScriptLocation = function () {
|
||||
return "/openlayers/";
|
||||
}
|
||||
|
||||
|
||||
function createMap(divName) {
|
||||
map = new OpenLayers.Map(divName, {
|
||||
controls: [
|
||||
new OpenLayers.Control.ArgParser(),
|
||||
new OpenLayers.Control.ArgParser(),
|
||||
new OpenLayers.Control.Attribution(),
|
||||
new OpenLayers.Control.LayerSwitcher(),
|
||||
new OpenLayers.Control.Navigation(),
|
||||
new OpenLayers.Control.PanZoomBar()
|
||||
]
|
||||
new OpenLayers.Control.Navigation(),
|
||||
new OpenLayers.Control.PanZoomBar(),
|
||||
new OpenLayers.Control.ScaleLine()
|
||||
],
|
||||
units: "m",
|
||||
maxResolution: 156543,
|
||||
numZoomLevels: 20
|
||||
});
|
||||
|
||||
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", { displayOutsideMaxExtent: true });
|
||||
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
|
||||
displayOutsideMaxExtent: true,
|
||||
wrapDateLine: true
|
||||
});
|
||||
map.addLayer(mapnik);
|
||||
|
||||
var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", { displayOutsideMaxExtent: true });
|
||||
var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
|
||||
displayOutsideMaxExtent: true,
|
||||
wrapDateLine: true
|
||||
});
|
||||
map.addLayer(osmarender);
|
||||
|
||||
var maplint = new OpenLayers.Layer.OSM.Maplint("Maplint", { displayOutsideMaxExtent: true });
|
||||
var maplint = new OpenLayers.Layer.OSM.Maplint("Maplint", {
|
||||
displayOutsideMaxExtent: true,
|
||||
wrapDateLine: true
|
||||
});
|
||||
map.addLayer(maplint);
|
||||
|
||||
var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels);
|
||||
markers = new OpenLayers.Layer.Markers("Markers", {
|
||||
displayInLayerSwitcher: false, numZoomLevels: numZoomLevels,
|
||||
markers = new OpenLayers.Layer.Markers("Markers", {
|
||||
displayInLayerSwitcher: false,
|
||||
numZoomLevels: numZoomLevels,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
|
||||
maxResolution: 156543,
|
||||
units: "m",
|
||||
projection: "EPSG:41001"
|
||||
projection: "EPSG:900913"
|
||||
});
|
||||
map.addLayer(markers);
|
||||
|
||||
|
@ -48,7 +63,7 @@ function getArrowIcon() {
|
|||
}
|
||||
|
||||
function addMarkerToMap(position, icon, description) {
|
||||
var marker = new OpenLayers.Marker(position, icon);
|
||||
var marker = new OpenLayers.Marker(position.clone().transform(epsg4326, map.getProjectionObject()), icon);
|
||||
|
||||
markers.addMarker(marker);
|
||||
|
||||
|
@ -62,11 +77,10 @@ function addMarkerToMap(position, icon, description) {
|
|||
function openMapPopup(marker, description) {
|
||||
closeMapPopup();
|
||||
|
||||
popup = new OpenLayers.Popup.AnchoredBubble("popup", marker.lonlat,
|
||||
sizeMapPopup(description),
|
||||
"<p style='padding-right: 28px'>" + description + "</p>",
|
||||
marker.icon, true);
|
||||
popup = new OpenLayers.Popup.AnchoredBubble("popup", marker.lonlat, null,
|
||||
description, marker.icon, true);
|
||||
popup.setBackgroundColor("#E3FFC5");
|
||||
popup.autoSize = true;
|
||||
map.addPopup(popup);
|
||||
|
||||
return popup;
|
||||
|
@ -79,31 +93,30 @@ function closeMapPopup() {
|
|||
}
|
||||
}
|
||||
|
||||
function sizeMapPopup(text) {
|
||||
var box = document.createElement("div");
|
||||
|
||||
box.innerHTML = text;
|
||||
box.style.visibility = "hidden";
|
||||
box.style.position = "absolute";
|
||||
box.style.top = "0px";
|
||||
box.style.left = "0px";
|
||||
box.style.width = "200px";
|
||||
box.style.height = "auto";
|
||||
|
||||
document.body.appendChild(box);
|
||||
|
||||
var width = box.offsetWidth;
|
||||
var height = box.offsetHeight;
|
||||
|
||||
document.body.removeChild(box);
|
||||
|
||||
return new OpenLayers.Size(width + 30, height + 24);
|
||||
}
|
||||
|
||||
function removeMarkerFromMap(marker){
|
||||
markers.removeMarker(marker);
|
||||
}
|
||||
|
||||
function getMapCenter(center, zoom) {
|
||||
return map.getCenter().clone().transform(map.getProjectionObject(), epsg4326);
|
||||
}
|
||||
|
||||
function setMapCenter(center, zoom) {
|
||||
map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);
|
||||
}
|
||||
|
||||
function setMapExtent(extent) {
|
||||
map.zoomToExtent(extent.clone().transform(epsg4326, map.getProjectionObject()));
|
||||
}
|
||||
|
||||
function getMapExtent(extent) {
|
||||
return map.getExtent().clone().transform(map.getProjectionObject(), epsg4326);
|
||||
}
|
||||
|
||||
function getEventPosition(event) {
|
||||
return map.getLonLatFromViewPortPx(event.xy).clone().transform(map.getProjectionObject(), epsg4326);
|
||||
}
|
||||
|
||||
function getMapLayers() {
|
||||
var layers = "";
|
||||
|
||||
|
@ -123,34 +136,19 @@ function getMapLayers() {
|
|||
function setMapLayers(layers) {
|
||||
for (var i=0; i < layers.length; i++) {
|
||||
var layer = map.layers[i];
|
||||
var c = layers.charAt(i);
|
||||
|
||||
if (c == "B") {
|
||||
map.setBaseLayer(layer);
|
||||
} else if ( (c == "T") || (c == "F") ) {
|
||||
layer.setVisibility(c == "T");
|
||||
if (layer) {
|
||||
var c = layers.charAt(i);
|
||||
|
||||
if (c == "B") {
|
||||
map.setBaseLayer(layer);
|
||||
} else if ( (c == "T") || (c == "F") ) {
|
||||
layer.setVisibility(c == "T");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mercatorToLonLat(merc) {
|
||||
var lon = (merc.lon / 20037508.34) * 180;
|
||||
var lat = (merc.lat / 20037508.34) * 180;
|
||||
|
||||
lat = 180/Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);
|
||||
|
||||
return new OpenLayers.LonLat(lon, lat);
|
||||
}
|
||||
|
||||
function lonLatToMercator(ll) {
|
||||
var lon = ll.lon * 20037508.34 / 180;
|
||||
var lat = Math.log(Math.tan((90 + ll.lat) * Math.PI / 360)) / (Math.PI / 180);
|
||||
|
||||
lat = lat * 20037508.34 / 180;
|
||||
|
||||
return new OpenLayers.LonLat(lon, lat);
|
||||
}
|
||||
|
||||
function scaleToZoom(scale) {
|
||||
return Math.log(360.0/(scale * 512.0)) / Math.log(2.0);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,18 @@ function updatelinks(lon,lat,zoom,layers) {
|
|||
node.href = setArgs(node.href, args);
|
||||
}
|
||||
|
||||
node = document.getElementById("exportanchor");
|
||||
if (node) {
|
||||
var args = getArgs(node.href);
|
||||
args["lat"] = lat;
|
||||
args["lon"] = lon;
|
||||
args["zoom"] = zoom;
|
||||
if (layers) {
|
||||
args["layers"] = layers;
|
||||
}
|
||||
node.href = setArgs(node.href, args);
|
||||
}
|
||||
|
||||
node = document.getElementById("editanchor");
|
||||
if (node) {
|
||||
if (zoom >= 11) {
|
||||
|
@ -36,7 +48,7 @@ function updatelinks(lon,lat,zoom,layers) {
|
|||
args.lat = lat;
|
||||
args.lon = lon;
|
||||
args.zoom = zoom;
|
||||
node.href = setArgs("/edit.html", args);
|
||||
node.href = setArgs("/edit", args);
|
||||
node.style.fontStyle = 'normal';
|
||||
} else {
|
||||
node.href = 'javascript:alert("zoom in to edit map");';
|
||||
|
|
BIN
public/openlayers/img/cloud-popup-relative.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
5
public/openlayers/theme/default/framedCloud.css
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
.olFramedCloudPopupContent {
|
||||
padding: 5px;
|
||||
overflow: auto;
|
||||
}
|
BIN
public/openlayers/theme/default/img/blank.gif
Normal file
After Width: | Height: | Size: 42 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
public/openlayers/theme/default/img/editing_tool_bar.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
public/openlayers/theme/default/img/overview_replacement.gif
Normal file
After Width: | Height: | Size: 79 B |
BIN
public/openlayers/theme/default/img/view_next_off.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
public/openlayers/theme/default/img/view_next_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
public/openlayers/theme/default/img/view_previous_off.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
public/openlayers/theme/default/img/view_previous_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
|
@ -1,4 +1,4 @@
|
|||
div.olMapViewport {
|
||||
div.olLayerDiv {
|
||||
-moz-user-select: none
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,31 @@ div.olMapViewport {
|
|||
bottom: 3em;
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-size: smaller;
|
||||
}
|
||||
.olControlScaleLine {
|
||||
left: 10px;
|
||||
bottom: 15px;
|
||||
font-size: xx-small;
|
||||
}
|
||||
.olControlScaleLineBottom {
|
||||
border: solid 2px black;
|
||||
border-bottom: none;
|
||||
margin-top:-2px;
|
||||
text-align: center;
|
||||
}
|
||||
.olControlScaleLineTop {
|
||||
border: solid 2px black;
|
||||
border-top: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.olControlPermalink {
|
||||
right: 3px;
|
||||
bottom: 1.5em;
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
div.olControlMousePosition {
|
||||
|
@ -62,9 +81,19 @@ div.olControlMousePosition {
|
|||
}
|
||||
|
||||
.olControlOverviewMapExtentRectangle {
|
||||
cursor: move;
|
||||
overflow: hidden;
|
||||
background-image: url("img/blank.gif");
|
||||
cursor: move;
|
||||
border: 2px dotted red;
|
||||
}
|
||||
.olControlOverviewMapRectReplacement {
|
||||
overflow: hidden;
|
||||
cursor: move;
|
||||
background-image: url("img/overview_replacement.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.olLayerGeoRSSDescription {
|
||||
float:left;
|
||||
width:100%;
|
||||
|
@ -75,7 +104,7 @@ div.olControlMousePosition {
|
|||
float:right;
|
||||
color:gray;
|
||||
font-size:1.2em;
|
||||
margin-right:6px;
|
||||
margin-right:6px;
|
||||
font-family:sans-serif;
|
||||
}
|
||||
.olLayerGeoRSSTitle {
|
||||
|
@ -84,6 +113,7 @@ div.olControlMousePosition {
|
|||
|
||||
.olPopupContent {
|
||||
padding:5px;
|
||||
overflow: auto;
|
||||
}
|
||||
.olControlNavToolbar {
|
||||
width:0px;
|
||||
|
@ -98,6 +128,31 @@ div.olControlMousePosition {
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.olControlNavigationHistoryPreviousItemActive {
|
||||
background-image: url("img/view_previous_on.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.olControlNavigationHistoryPreviousItemInactive {
|
||||
background-image: url("img/view_previous_off.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.olControlNavigationHistoryNextItemActive {
|
||||
background-image: url("img/view_next_on.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.olControlNavigationHistoryNextItemInactive {
|
||||
background-image: url("img/view_next_off.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.olControlNavToolbar .olControlNavigationItemActive {
|
||||
background-image: url("img/panning-hand-on.png");
|
||||
background-repeat: no-repeat;
|
||||
|
@ -128,34 +183,64 @@ div.olControlMousePosition {
|
|||
margin: 5px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlNavigationItemActive {
|
||||
background-image: url("img/pan_on.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -103px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlNavigationItemInactive {
|
||||
background-image: url("img/pan_off.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -103px -0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePointItemActive {
|
||||
background-image: url("img/draw_point_on.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -77px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
|
||||
background-image: url("img/draw_point_off.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -77px -0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
|
||||
background-image: url("img/draw_line_off.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -51px 0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePathItemActive {
|
||||
background-image: url("img/draw_line_on.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -51px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive {
|
||||
background-image: url("img/draw_polygon_off.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -26px 0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
|
||||
background-image: url("img/draw_polygon_on.png");
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: -26px -23px ;
|
||||
}
|
||||
|
||||
.olHandlerBoxZoomBox {
|
||||
border: 2px solid red;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
opacity: 0.50;
|
||||
font-size: 1px;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
/*
|
||||
* Due to current limitations in the OpenLayers code, you can only
|
||||
* replace this image with another image which is 17px x 17px.
|
||||
*/
|
||||
.olPopupCloseBox {
|
||||
background: url("img/close.gif") no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.olControlNoSelect {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.olControlPanZoom {
|
||||
.olControlPanZoomBar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -525,7 +525,11 @@ hides rule from IE5-Mac \*/
|
|||
list-style: square;
|
||||
}
|
||||
|
||||
input {
|
||||
input[type="text"], input[type="password"], textarea {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
|
@ -569,6 +573,14 @@ input {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
#sotminfo a:link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#sotminfo a:visited {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#permalink {
|
||||
z-index:10000;
|
||||
position:absolute;
|
||||
|
@ -580,3 +592,45 @@ input {
|
|||
#attribution {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.export_heading {
|
||||
margin: 0px;
|
||||
padding: 3px 6px 3px 6px;
|
||||
border: 1px solid #ccc;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.export_bounds {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.export_bound {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.export_details {
|
||||
padding: 2px 6px 2px 6px;
|
||||
}
|
||||
|
||||
#export_osm {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#export_mapnik {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#export_osmarender {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.export_hint {
|
||||
padding: 0px 12px 0px 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.export_buttons {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
|