+# coding: utf-8
#
# Cookbook Name:: imagery
# Recipe:: gb_os_sv
imagery_site "os.openstreetmap.org" do
aliases ["os.openstreetmap.org.uk"]
- git_repository "https://github.com/Firefishy/osm-imagery-os-site.git"
+ bbox [[49.85, -10.5], [58.75, 1.9]]
end
imagery_layer "gb_os_sv_2010_04" do
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2010-04-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2010" # FIXME: Correct Copyright?
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2010" # FIXME: Correct Copyright?
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2010-04"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2010-11-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2010" # FIXME: Correct Copyright?
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2010" # FIXME: Correct Copyright?
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2010-11"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2011-05-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2011" # FIXME: Correct Copyright?
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2011" # FIXME: Correct Copyright?
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2011-05"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2011-11-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2011" # FIXME: Correct Copyright?
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2011" # FIXME: Correct Copyright?
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2011-11"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2012-05-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2012"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2012"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2012-05"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2012-11-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2012"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2012"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2012-11"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2013-05-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2013"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2013"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2013-05"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2013-11-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2013"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2013"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2013-11"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2014-04-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2014"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2014"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2014-04"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2014-10-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2014"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2014"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2014-10"]
site "os.openstreetmap.org"
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2015-05-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2015"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2015"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2015-05"]
root_layer true
projection "EPSG:27700"
source "/data/imagery/gb/os-sv/ossv-2015-11-combined.vrt"
- copyright "Contains Ordnance Survey data © Crown copyright and database right 2015"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2015"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2015-11"]
root_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"
+ copyright "Contains Ordnance Survey data © Crown copyright and database right 2016"
background_colour "230 246 255" # OSSV Water Blue
extension "os_sv_png"
url_aliases ["/sv-2016-04", "/sv"] # Add "/sv" to current edition for backward compatibility
# limitations under the License.
#
+require "yaml"
+
default_action :create
property :name, String
property :aliases, [String, Array], :default => []
-property :git_repository, String, :default => "https://github.com/Firefishy/osm-imagery-default.git"
+property :bbox, Array, :required => true
action :create do
- git "/srv/#{name}" do
- action :sync
- repository "#{git_repository}"
- revision "master"
- enable_submodules true
- retries 3
+ directory "/srv/#{name}" do
+ user "root"
+ group "root"
+ mode 0755
+ end
+
+ directory "/srv/imagery/layers/#{name}" do
+ user "root"
+ group "root"
+ mode 0755
+ recursive true
+ end
+
+ directory "/srv/imagery/overlays/#{name}" do
+ user "root"
+ group "root"
+ mode 0755
+ recursive true
+ end
+
+ template "/srv/#{name}/index.html" do
+ source "index.html.erb"
+ user "root"
+ group "root"
+ mode 0644
+ variables :title => name
+ end
+
+ cookbook_file "/srv/#{name}/imagery.css" do
+ source "imagery.css"
+ user "root"
+ group "root"
+ mode 0644
+ end
+
+ layers = Dir.glob("/srv/imagery/layers/#{name}/*.yml").collect do |path|
+ YAML.load(::File.read(path))
+ end
+
+ overlays = Dir.glob("/srv/imagery/overlays/#{name}/*.yml").collect do |path|
+ YAML.load(::File.read(path))
+ end
+
+ template "/srv/#{name}/imagery.js" do
+ source "imagery.js.erb"
user "root"
group "root"
+ mode 0644
+ variables :bbox => bbox, :layers => layers, :overlays => overlays
end
nginx_site name do
--- /dev/null
+function createMap(divName) {
+ // Create a map
+ var map = L.map(divName);
+
+ // Create a layer switcher
+ var layers = L.control.layers();
+
+ // Add OpenStreetMap layer
+ layers.addBaseLayer(L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
+ attribution: "© <a target=\"_parent\" href=\"http://www.openstreetmap.org\">OpenStreetMap</a> and contributors, under an <a target=\"_parent\" href=\"http://www.openstreetmap.org/copyright\">open license</a>",
+ maxZoom: 19
+ }), "OpenStreetMap");
+
+ <% @layers.each do |layer| -%>
+ // Add <%= layer[:name].to_json %> layer
+ layers.addBaseLayer(L.tileLayer(<%= layer[:url].to_json %>, {
+ attribution: <%= layer[:attribution].to_json %>
+ }), <%= layer[:name].to_json %>);
+
+ <% end -%>
+ <% @overlays.each do |layer| -%>
+ // Add <%= layer[:name].to_json %> layer
+ layers.addOverlay(L.tileLayer(<%= layer[:url].to_json %>, {
+ attribution: <%= layer[:attribution].to_json %>
+ }), <%= layer[:name].to_json %>);
+
+ <% end -%>
+ // Add the layer switch to the mao
+ layers.addTo(map);
+
+ // Zoom to specified bounds
+ map.fitBounds(<%= @bbox.to_json %>);
+
+ return map;
+}