Skip to content

Commit

Permalink
fix: display mailles
Browse files Browse the repository at this point in the history
  • Loading branch information
juggler31 committed Sep 30, 2024
1 parent 5cfa411 commit 9fcc704
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions data/atlas/13.atlas.vm_observations_mailles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9fcc704

Please sign in to comment.