imagery_layer "au_ga_agri" do
site "agri.openstreetmap.org"
root_layer true
+ default_layer true
text "AGRI: The Australian Geographic Reference Image"
copyright "Commonwealth of Australia (Geoscience Australia) - Creative Commons Attribution 4.0 International Licence"
background_colour "0 0 0" # Black
imagery_layer "gb_hampshire_aerial_rgb" do
site "hampshire.aerial.openstreetmap.org.uk"
root_layer true
+ default_layer true
text "Hampshire Aerial - Summer 2013"
source "/data/imagery/gb/hampshire-aerial/hampshire-aerial-RGB.tif"
projection "EPSG:27700"
imagery_layer "gb_os_sv_2016_04" do
site "os.openstreetmap.org"
root_layer true
+ default_layer true
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2016-04-combined.vrt"
copyright "Contains Ordnance Survey data © Crown copyright and database right 2016"
imagery_layer "gb_surrey_aerial" do
site "surrey.aerial.openstreetmap.org.uk"
root_layer true
+ default_layer true
projection "EPSG:27700"
source "/data/imagery/gb/surrey-aerial/SurreyMosaicECW.tif"
text "Surrey Air Survey - 2008/2009"
property :url_aliases, [String, Array], :default => []
property :revision, Fixnum, :default => 1
property :overlay, [TrueClass, FalseClass], :default => false
+property :default_layer, [TrueClass, FalseClass], :default => false
action :create do
file "create layer yaml definition" do
content YAML.dump(:name => layer,
:url => "http://#{site}/layer/#{layer}/{z}/{x}/{y}.png",
:attribution => copyright,
+ :default => default_layer,
:maxZoom => max_zoom)
end
}), "OpenStreetMap");
<% @layers.sort_by { |layer| layer[:name] }.each do |layer| -%>
- // Add <%= layer[:name].to_json %> layer
- layers.addBaseLayer(L.tileLayer(<%= layer[:url].to_json %>, {
+ // Create <%= layer[:name] %> layer
+ var <%= layer[:name] %> = L.tileLayer(<%= layer[:url].to_json %>, {
attribution: <%= layer[:attribution].to_json %>,
maxZoom: <%= layer[:maxZoom].to_json %>
- }), <%= layer[:name].to_json %>);
+ });
+
+ // Add <%= layer[:name] %> to layer switcher
+ layers.addBaseLayer(<%= layer[:name] %>, <%= layer[:name].to_json %>);
+ <% if layer[:default] -%>
+ // Add <%= layer[:name] %> to map
+ <%= layer[:name] %>.addTo(map);
+ <% end -%>
<% end -%>
<% @overlays.sort_by { |layer| layer[:name] }.each do |layer| -%>
- // Add <%= layer[:name].to_json %> layer
+ // Add <%= layer[:name] %> to layer switcher
layers.addOverlay(L.tileLayer(<%= layer[:url].to_json %>, {
attribution: <%= layer[:attribution].to_json %>,
maxZoom: <%= layer[:maxZoom].to_json %>