diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccece28ed..0adfd4324 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+### 4.8.14
+- Added global statistics download
+- Fixed PAME file downloads
+- Limited map zoom on global WMS layer
+- Updated external API calls to work after API changes
+- Stopped trying to load geom into memory and use extent to determine whether PA is point or polygon
+- Fixed region links on search results
+- Minor text changes
+-
### 4.8.13
- Removed MPA download option
- Changed Mapbox basemap to most recent version
diff --git a/app/assets/stylesheets/components/cards/cards/_cards-squares.scss b/app/assets/stylesheets/components/cards/cards/_cards-squares.scss
index 3bc232a33..3e5fabfdb 100644
--- a/app/assets/stylesheets/components/cards/cards/_cards-squares.scss
+++ b/app/assets/stylesheets/components/cards/cards/_cards-squares.scss
@@ -60,5 +60,10 @@ $cards-squares-width-tablet: 48%;
&:before { @include border-radius; }
}
+
+ &__title {
+ overflow-wrap: break-word;
+ text-align: center;
+ }
}
}
\ No newline at end of file
diff --git a/app/controllers/global_statistics_controller.rb b/app/controllers/global_statistics_controller.rb
new file mode 100644
index 000000000..f065b2594
--- /dev/null
+++ b/app/controllers/global_statistics_controller.rb
@@ -0,0 +1,5 @@
+class GlobalStatisticsController < ApplicationController
+ def download
+ send_file GlobalStatistic.latest_csv, type: 'text/csv', disposition: 'attachment'
+ end
+end
diff --git a/app/controllers/pame_controller.rb b/app/controllers/pame_controller.rb
index f2fa7ff90..3358f21e8 100644
--- a/app/controllers/pame_controller.rb
+++ b/app/controllers/pame_controller.rb
@@ -7,9 +7,6 @@ class PameController < ApplicationController
filters: []
}.to_json
- # Format for this date is: Year-MON (4 digits-3 chars)
- UPDATED_AT = "2020-DEC".freeze
-
def index
@table_attributes = PameEvaluation::TABLE_ATTRIBUTES.to_json
@filters = PameEvaluation.filters_to_json
@@ -26,10 +23,11 @@ def list
end
def download
+ last_update = PameEvaluation.last_csv_update_date.strftime('%Y-%^b')
send_data PameEvaluation.to_csv(params.to_json), {
type: "text/csv; charset=utf-8; header=present",
disposition: "attachment",
- filename: "protectedplanet-pame-#{UPDATED_AT}.csv" }
+ filename: "protectedplanet-pame-#{last_update}.csv" }
end
end
diff --git a/app/controllers/protected_areas_controller.rb b/app/controllers/protected_areas_controller.rb
index 8d830f8b6..164cb66aa 100644
--- a/app/controllers/protected_areas_controller.rb
+++ b/app/controllers/protected_areas_controller.rb
@@ -43,7 +43,8 @@ def show
@map_options = {
map: {
- boundsUrl: @protected_area.extent_url
+ boundsUrl: @protected_area.extent_url,
+ maxZoom: 0
}
}
diff --git a/app/helpers/map_helper.rb b/app/helpers/map_helper.rb
index 693e673bc..c1c3215eb 100644
--- a/app/helpers/map_helper.rb
+++ b/app/helpers/map_helper.rb
@@ -104,7 +104,7 @@ def all_services_for_point_query
def country_extent_url (iso3)
{
- url: "https://data-gis.unep-wcmc.org/server/rest/services/GADM_EEZ_Layer/FeatureServer/0/query?where=iso_ter+%3D+%27#{iso3}%27&returnGeometry=false&returnExtentOnly=true&outSR=4326&f=pjson",
+ url: "https://data-gis.unep-wcmc.org/server/rest/services/GADM_EEZ_Layer/FeatureServer/0/query?where=iso_ter+%3D+#{iso3}&returnGeometry=false&returnExtentOnly=true&outSR=4326&f=pjson",
padding: 5
}
end
diff --git a/app/javascript/components/map/default-options.js b/app/javascript/components/map/default-options.js
index ed1d1bd39..8078d0178 100644
--- a/app/javascript/components/map/default-options.js
+++ b/app/javascript/components/map/default-options.js
@@ -17,6 +17,7 @@ export const MAP_OPTIONS_DEFAULT = {
attributionControl: false,
preserveDrawingBuffer: true, // needed for PDF rendering
zoom: 1.3,
+ maxZoom: 10 // Maximum zoom where tiles are cached for the web-map service
//bounds: [[-180, -90], [180, 90]],
//boundingISO: ISO3,
//boundingRegion; Name e.g. Europe,
diff --git a/app/models/global_statistic.rb b/app/models/global_statistic.rb
index a39045e8d..4922cbef4 100644
--- a/app/models/global_statistic.rb
+++ b/app/models/global_statistic.rb
@@ -39,4 +39,9 @@ def self.green_list_stats
self.instance.send(column_name)
end
end
+
+ def self.latest_csv
+ global_statistics_csvs = Dir.glob("#{Rails.root}/lib/data/seeds/global_statistics*")
+ global_statistics_csvs.sort.last
+ end
end
\ No newline at end of file
diff --git a/app/models/pame_evaluation.rb b/app/models/pame_evaluation.rb
index c7399de5e..46d3fcb78 100644
--- a/app/models/pame_evaluation.rb
+++ b/app/models/pame_evaluation.rb
@@ -336,6 +336,12 @@ def self.to_csv(json = nil)
generate_csv(where_statement, restricted_where_statement)
end
+
+ def self.last_csv_update_date
+ pame_data_csvs = Dir.glob("#{Rails.root}/lib/data/seeds/pame_data*")
+ latest_pame_csv = pame_data_csvs.sort.last.split('_').last
+ latest_pame_csv.split('.').first.to_date
+ end
end
diff --git a/app/models/protected_area.rb b/app/models/protected_area.rb
index f5f3b833f..3cb2b717b 100644
--- a/app/models/protected_area.rb
+++ b/app/models/protected_area.rb
@@ -237,12 +237,12 @@ def arcgis_layer
end
def arcgis_query_string
- "/query?where=wdpaid+%3D+%27#{wdpa_id}%27&geometryType=esriGeometryEnvelope&returnGeometry=true&f=geojson"
+ "/query?where=wdpaid+%3D+#{wdpa_id}&geometryType=esriGeometryEnvelope&returnGeometry=true&f=geojson"
end
def extent_url
{
- url: "#{arcgis_layer}/query?where=wdpaid+%3D+%27#{wdpa_id}%27&returnGeometry=false&returnExtentOnly=true&outSR=4326&f=pjson",
+ url: "#{arcgis_layer}/query?where=wdpaid+%3D+#{wdpa_id}&returnGeometry=false&returnExtentOnly=true&outSR=4326&f=pjson",
padding: 0.2
}
end
@@ -254,7 +254,10 @@ def is_whs?
private
def is_point?
- the_geom.geometry_type.type_name.match('Point').present?
+ @is_point ||= begin
+ extent = bounds
+ extent[0][0] == extent[1][0] && extent[0][1] == extent[1][1]
+ end
end
def bounding_box_query
diff --git a/app/serializers/search/areas_serializer.rb b/app/serializers/search/areas_serializer.rb
index c0a6864e3..2b65c9639 100644
--- a/app/serializers/search/areas_serializer.rb
+++ b/app/serializers/search/areas_serializer.rb
@@ -34,7 +34,7 @@ def sites
def geo_hash(geo_type, areas, total=0)
areas = areas.present? ? areas.first(9) : []
- geo_type_locale = geo_type == 'site' ? 'area-types.wdpa' : "geo-types.#{geo_type.pluralize}"
+ geo_type_locale = "geo-types.#{geo_type.pluralize}"
{
geoType: geo_type,
title: I18n.t("global.#{geo_type_locale}"),
diff --git a/app/serializers/search/base_serializer.rb b/app/serializers/search/base_serializer.rb
index 5560a1112..9901355ea 100644
--- a/app/serializers/search/base_serializer.rb
+++ b/app/serializers/search/base_serializer.rb
@@ -39,6 +39,8 @@ def url(obj)
protected_area_path(obj.wdpa_id)
elsif obj.is_a?(Country)
country_path(iso: obj.iso_3)
+ elsif obj.is_a?(Region)
+ region_path(iso: obj.iso)
else
'#'
end
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index 1b058dc58..fc08755db 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -8,6 +8,7 @@
Statistics updated: <%= @update_date %>