From c868b0c7996705a96dc70de2d3730c80625df197 Mon Sep 17 00:00:00 2001
From: Marc Florisson
Date: Mon, 24 Jun 2013 16:51:25 +0200
Subject: adapt IGN maps
---
app/maps/application_map.rb | 40 ++++++++++++++++++++++++++++----------
config/environments/development.rb | 2 +-
config/locales/maps.yml | 16 +++++++++++++--
3 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb
index d06a7e640..78141b535 100644
--- a/app/maps/application_map.rb
+++ b/app/maps/application_map.rb
@@ -49,8 +49,14 @@ class ApplicationMap
def map
@map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page|
+ if self.geoportail_key
+ page << map.add_layer(geoportail_ortho_wmts)
+ page << map.add_layer(geoportail_scans_wmts)
+ page << map.add_layer(geoportail_cadastre_wmts)
+ end
+
page << map.add_layer(MapLayers::OSM_MAPNIK)
- page << map.add_layer(geoportail_wmts) if self.geoportail_key
+ #page << map.add_layers([geoportail_scans, geoportail_ortho])
page << map.add_layer(google_physical)
page << map.add_layer(google_streets)
page << map.add_layer(google_hybrid)
@@ -74,15 +80,29 @@ class ApplicationMap
def kml
OpenLayers::Format::KML.new :extractStyles => true, :extractAttributes => true, :maxDepth => 2
end
+ def geoportail_cadastre_wmts
+ OpenLayers::Layer::WMTS.new( geoportail_options.update(:name => I18n.t("maps.ign_cadastre"),
+ :format => "image/png",
+ :layer => "CADASTRALPARCELS.PARCELS"))
+ end
+
+ def geoportail_ortho_wmts
+ OpenLayers::Layer::WMTS.new( geoportail_options.update(:name => I18n.t("maps.ign_ortho"),
+ :layer => "ORTHOIMAGERY.ORTHOPHOTOS"))
+ end
+
+ def geoportail_scans_wmts
+ OpenLayers::Layer::WMTS.new( geoportail_options.update(:name => I18n.t("maps.ign_map"),
+ :layer => "GEOGRAPHICALGRIDSYSTEMS.MAPS"))
+ end
- def geoportail_wmts
- OpenLayers::Layer::WMTS.new :name => I18n.t("maps.ign_map"),
- :url => "http://gpp3-wxs.ign.fr/#{self.geoportail_key}/wmts",
- :layer => "GEOGRAPHICALGRIDSYSTEMS.MAPS",
+ def geoportail_options
+ { :url => "http://gpp3-wxs.ign.fr/#{self.geoportail_key}/wmts",
:matrixSet => "PM",
:style => "normal",
:numZoomLevels => 19,
- :attribution => 'Map base: ©IGN
Terms of Service'
+ :group => "IGN",
+ :attribution => 'Map base: ©IGN
Terms of Service'}
end
def strategy_fixed
@@ -90,20 +110,20 @@ class ApplicationMap
end
def google_physical
- OpenLayers::Layer::Google.new("Google Physical",
+ OpenLayers::Layer::Google.new(I18n.t("maps.google_physical"),
:type => :"google.maps.MapTypeId.TERRAIN")
end
def google_streets
- OpenLayers::Layer::Google.new "Google Streets", :numZoomLevels => 20
+ OpenLayers::Layer::Google.new I18n.t("maps.google_streets"), :numZoomLevels => 20
end
def google_hybrid
- OpenLayers::Layer::Google.new "Google Hybrid", :type => :"google.maps.MapTypeId.HYBRID", :numZoomLevels => 20
+ OpenLayers::Layer::Google.new I18n.t("maps.google_hybrid"), :type => :"google.maps.MapTypeId.HYBRID", :numZoomLevels => 20
end
def google_satellite
- OpenLayers::Layer::Google.new "Google Satellite", :type => :"google.maps.MapTypeId.SATELLITE", :numZoomLevels => 22
+ OpenLayers::Layer::Google.new I18n.t("maps.google_satellite"), :type => :"google.maps.MapTypeId.SATELLITE", :numZoomLevels => 22
end
def hover_control_display_name(layer)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 84a5f61e9..12618b1ed 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -44,7 +44,7 @@ ChouetteIhm::Application.configure do
}
# api key to geoportail IGN (development key 3 month validity)
- # config.geoportail_api_key = "i2aqyge3x3iovnuhz7z06flp"
+ config.geoportail_api_key = "f1t6wihbh98njlbaf5cuzxy4"
config.to_prepare do
Devise::Mailer.layout "mailer"
diff --git a/config/locales/maps.yml b/config/locales/maps.yml
index 339ad206d..ea01961dc 100644
--- a/config/locales/maps.yml
+++ b/config/locales/maps.yml
@@ -1,8 +1,20 @@
en:
maps:
- ign_map: "IGN maps"
+ ign_map: "IGN scans"
+ ign_ortho: "IGN orthophotos"
+ ign_cadastre: "IGN parcels"
+ google_physical: "Google physical"
+ google_streets: "Google streets"
+ google_hybrid: "Google hybrid"
+ google_satellite: "Google orthophotos"
fr:
maps:
- ign_map: "Cartes IGN"
+ ign_map: "Scans IGN"
+ ign_ortho: "Orthophoto IGN"
+ ign_cadastre: "Cadastre IGN"
+ google_physical: "Relief Google"
+ google_streets: "Routier Google"
+ google_hybrid: "Hybride Google"
+ google_satellite: "Orthophoto Google"
--
cgit v1.2.3