-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: detail observation when display mailles (#577)
- Loading branch information
Showing
4 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
CREATE MATERIALIZED VIEW atlas.vm_observations_mailles AS | ||
SELECT | ||
o.cd_ref, | ||
date_part('year', o.dateobs) AS annee, | ||
m.id_maille, | ||
COUNT(o.id_observation) AS nbr | ||
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 | ||
ORDER BY o.cd_ref, annee | ||
WITH DATA; | ||
CREATE MATERIALIZED VIEW atlas.vm_observations_mailles AS | ||
SELECT | ||
o.cd_ref, | ||
date_part('year', o.dateobs) AS annee, | ||
m.id_maille, | ||
COUNT(o.id_observation) AS nbr, | ||
ARRAY_AGG(o.id_observation) AS id_observations | ||
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 | ||
ORDER BY o.cd_ref, annee | ||
WITH DATA; | ||
|
||
CREATE UNIQUE INDEX ON atlas.vm_observations_mailles | ||
USING btree (cd_ref, annee, id_maille); | ||
CREATE UNIQUE INDEX ON atlas.vm_observations_mailles | ||
USING btree (cd_ref, annee, id_maille); | ||
|
||
CREATE INDEX ON atlas.vm_observations_mailles | ||
USING btree (annee); | ||
CREATE INDEX ON atlas.vm_observations_mailles | ||
USING btree (annee); | ||
|
||
CREATE INDEX ON atlas.vm_observations_mailles | ||
USING btree (id_maille, cd_ref); | ||
CREATE INDEX ON atlas.vm_observations_mailles | ||
USING gin (id_observations); | ||
|
||
CREATE INDEX ON atlas.vm_observations_mailles | ||
USING btree (id_maille, cd_ref); |