2018-10-22 19:27:52 +02:00
|
|
|
class GeoAreaSerializer < ActiveModel::Serializer
|
2018-10-30 11:05:08 +01:00
|
|
|
attributes :geometry, :source, :geo_reference_id
|
2018-10-23 15:40:39 +02:00
|
|
|
|
|
|
|
attribute :surface_intersection, if: :include_cadastre?
|
|
|
|
attribute :surface_parcelle, if: :include_cadastre?
|
|
|
|
attribute :numero, if: :include_cadastre?
|
|
|
|
attribute :feuille, if: :include_cadastre?
|
|
|
|
attribute :section, if: :include_cadastre?
|
|
|
|
attribute :code_dep, if: :include_cadastre?
|
|
|
|
attribute :nom_com, if: :include_cadastre?
|
|
|
|
attribute :code_com, if: :include_cadastre?
|
|
|
|
attribute :code_arr, if: :include_cadastre?
|
|
|
|
|
2020-10-08 16:02:52 +02:00
|
|
|
def geometry
|
2023-02-15 17:39:19 +01:00
|
|
|
object.geometry
|
2020-10-08 16:02:52 +02:00
|
|
|
end
|
|
|
|
|
2018-10-23 15:40:39 +02:00
|
|
|
def include_cadastre?
|
|
|
|
object.source == GeoArea.sources.fetch(:cadastre)
|
|
|
|
end
|
2018-10-22 19:27:52 +02:00
|
|
|
end
|