Expose multiple user selections on champ carte

This commit is contained in:
Paul Chavard 2020-04-09 17:32:20 +02:00
parent 55e99a323c
commit 22604013d0
14 changed files with 230 additions and 245 deletions

View file

@ -27,11 +27,20 @@ class GeoArea < ApplicationRecord
selection_utilisateur: 'selection_utilisateur'
}
scope :selections_utilisateur, -> { where(source: sources.fetch(:selection_utilisateur)) }
scope :quartiers_prioritaires, -> { where(source: sources.fetch(:quartier_prioritaire)) }
scope :cadastres, -> { where(source: sources.fetch(:cadastre)) }
scope :parcelles_agricoles, -> { where(source: sources.fetch(:parcelle_agricole)) }
def selection_utilisateur?
source == self.class.sources.fetch(:selection_utilisateur)
def to_feature
{
type: 'Feature',
geometry: geometry,
properties: properties.merge(source: source)
}
end
def rgeo_geometry
RGeo::GeoJSON.decode(geometry.to_json, geo_factory: RGeo::Geographic.simple_mercator_factory)
end
end