diff --git a/atlas/modeles/repositories/vmObservationsMaillesRepository.py b/atlas/modeles/repositories/vmObservationsMaillesRepository.py index f6edb9ba..584cf8ca 100644 --- a/atlas/modeles/repositories/vmObservationsMaillesRepository.py +++ b/atlas/modeles/repositories/vmObservationsMaillesRepository.py @@ -59,10 +59,12 @@ def lastObservationsMailles(connection, mylimit, idPhoto): SELECT obs.*, tax.lb_nom, tax.nom_vern, tax.group2_inpn, o.dateobs, o.altitude_retenue, - medias.url, medias.chemin, medias.id_media + medias.url, medias.chemin, medias.id_media, + m.geojson_maille FROM atlas.vm_observations_mailles obs JOIN atlas.vm_taxons tax ON tax.cd_ref = obs.cd_ref JOIN atlas.vm_observations o ON o.id_observation=obs.id_observation + JOIN atlas.t_mailles_territoire m ON m.id_maille=obs.id_maille LEFT JOIN atlas.vm_medias medias ON medias.cd_ref = obs.cd_ref AND medias.id_type = :thisID WHERE o.dateobs >= (CURRENT_TIMESTAMP - INTERVAL :thislimit) diff --git a/data/atlas/13.atlas.vm_observations_mailles.sql b/data/atlas/13.atlas.vm_observations_mailles.sql index 557bfa75..eca6fb39 100644 --- a/data/atlas/13.atlas.vm_observations_mailles.sql +++ b/data/atlas/13.atlas.vm_observations_mailles.sql @@ -3,11 +3,12 @@ CREATE MATERIALIZED VIEW atlas.vm_observations_mailles AS o.cd_ref, date_part('year', o.dateobs) AS annee, m.id_maille, - COUNT(o.id_observation) AS nbr + COUNT(o.id_observation) AS nbr, + o.id_observation FROM atlas.vm_observations AS o JOIN atlas.t_mailles_territoire AS m ON (o.the_geom_point && m.the_geom) - GROUP BY o.cd_ref, date_part('year', o.dateobs), m.id_maille + GROUP BY o.cd_ref, date_part('year', o.dateobs), m.id_maille, o.id_observation ORDER BY o.cd_ref, annee WITH DATA;