From: Grant Slater Date: Mon, 31 Oct 2022 22:49:11 +0000 (+0000) Subject: imagery: Cleanup proj handling with EPSG:27700 conversion X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/4d8060c4c7b01fffd02339d1dd869e4a5dfcca52 imagery: Cleanup proj handling with EPSG:27700 conversion Proj7+ now has significantly better handling of EPSG:27700 conversion and will automatically use a grid file if available. --- diff --git a/cookbooks/imagery/recipes/default.rb b/cookbooks/imagery/recipes/default.rb index f8f811988..ad233f232 100644 --- a/cookbooks/imagery/recipes/default.rb +++ b/cookbooks/imagery/recipes/default.rb @@ -64,28 +64,16 @@ directory "/srv/imagery/common" do end directory "/srv/imagery/common/ostn02-ntv2-data" do - owner "root" - group "root" - mode "755" + recursive true + action :delete end +# Pre-download uk_os_OSTN15_NTv2_OSGBtoETRS.tif used for EPSG:27700 conversions execute "uk_os_OSTN15_NTv2_OSGBtoETRS.tif" do command "projsync --file uk_os_OSTN15_NTv2_OSGBtoETRS.tif --system-directory" not_if { ::File.exist?("/usr/share/proj/uk_os_OSTN15_NTv2_OSGBtoETRS.tif") } end -remote_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do - source "https://www.ordnancesurvey.co.uk/documents/resources/ostn02-ntv2-data.zip" - not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") } -end - -archive_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do - destination "/srv/imagery/common/ostn02-ntv2-data" - owner "root" - group "root" - not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") } -end - nginx_site "default" do template "nginx_default.conf.erb" directory "/srv/imagery/default" diff --git a/cookbooks/imagery/templates/default/mapserver.map.erb b/cookbooks/imagery/templates/default/mapserver.map.erb index 1f918d0f8..c918ca9f1 100644 --- a/cookbooks/imagery/templates/default/mapserver.map.erb +++ b/cookbooks/imagery/templates/default/mapserver.map.erb @@ -44,10 +44,7 @@ MAP <% end -%> IMAGETYPE <%= @extension %> PROJECTION - <% if @projection == "EPSG:27700" -%> - <%# Override EPSG:27700 to use accurate nadgrid %> - "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb" - <% elsif @projection == "namibia_aerial" -%> + <% if @projection == "namibia_aerial" -%> "+proj=tmerc +lat_0=0 +lon_0=17 +k=1 +x_0=600000 +y_0=10000000 +ellps=WGS84 +units=m +no_defs" <% else -%> "init=<%= @projection.downcase %>" @@ -58,10 +55,7 @@ MAP NAME "<%= @layer %>" DATA "<%= @source %>" PROJECTION - <% if @projection == "EPSG:27700" -%> - <%# Override EPSG:27700 to use accurate nadgrid %> - "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb" - <% elsif @projection == "namibia_aerial" -%> + <% if @projection == "namibia_aerial" -%> "+proj=tmerc +lat_0=0 +lon_0=17 +k=1 +x_0=600000 +y_0=10000000 +ellps=WGS84 +units=m +no_defs" <% else -%> "init=<%= @projection.downcase %>"