Merge pull request #5859 from tchak/fix-champ-carto
Stop crashing if a selection utilisateur contains no geometry
This commit is contained in:
commit
6a5722a5e5
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ class Champs::CarteController < ApplicationController
|
||||||
|
|
||||||
def cadastres_features_collection(feature_collection)
|
def cadastres_features_collection(feature_collection)
|
||||||
coordinates = feature_collection[:features].filter do |feature|
|
coordinates = feature_collection[:features].filter do |feature|
|
||||||
feature[:properties][:source] == GeoArea.sources.fetch(:selection_utilisateur) && feature[:geometry]['type'] == 'Polygon'
|
feature[:properties][:source] == GeoArea.sources.fetch(:selection_utilisateur) && feature[:geometry] && feature[:geometry]['type'] == 'Polygon'
|
||||||
end.map do |feature|
|
end.map do |feature|
|
||||||
feature[:geometry]['coordinates'][0].map { |(lng, lat)| { 'lng' => lng, 'lat' => lat } }
|
feature[:geometry]['coordinates'][0].map { |(lng, lat)| { 'lng' => lng, 'lat' => lat } }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue