Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
fonctionnalites:geonature-atlas:integration-biodiv-territoire [2025/06/12 09:36] – [Ajout de filtres] jpmilcent | fonctionnalites:geonature-atlas:integration-biodiv-territoire [2025/07/11 18:46] (Version actuelle) – [Contraintes Atlas v2 et GN branche feat/sinp] jpmilcent | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
===== Infos ===== | ===== Infos ===== | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
===== Rappel du contexte ===== | ===== Rappel du contexte ===== | ||
Ligne 85: | Ligne 88: | ||
L' | L' | ||
+ | === Tickets existants === | ||
+ | * [[https:// | ||
==== Ajout de filtres ==== | ==== Ajout de filtres ==== | ||
Sur la fiche Territoire, au niveau de l' | Sur la fiche Territoire, au niveau de l' | ||
Ligne 92: | Ligne 97: | ||
=== Questions/ | === Questions/ | ||
- | * < | + | * < |
==== Ajout d'un filtre par groupe taxo ==== | ==== Ajout d'un filtre par groupe taxo ==== | ||
Ligne 134: | Ligne 139: | ||
* la nécessité retravailler les développements existants dans l' | * la nécessité retravailler les développements existants dans l' | ||
* de l' | * de l' | ||
+ | |||
+ | ===== Contraintes Atlas v2 et GN branche feat/sinp ===== | ||
+ | * Nécessite de rajouter les tables suivante à la base GeoNature 2.10 branche '' | ||
+ | * Nécessite d' | ||
+ | UPDATE ref_geo.l_areas SET | ||
+ | enable = TRUE | ||
+ | WHERE id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | </ | ||
+ | * Nécessite de peupler la table '' | ||
+ | INSERT INTO ref_geo.cor_areas ( | ||
+ | id_area_group, | ||
+ | id_area | ||
+ | ) | ||
+ | SELECT | ||
+ | p.id_area AS id_area_goup, | ||
+ | c.id_area | ||
+ | FROM ref_geo.l_areas AS p, ref_geo.l_areas AS c | ||
+ | WHERE p.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND p." | ||
+ | AND c.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND c." | ||
+ | | ||
+ | UNION | ||
+ | | ||
+ | SELECT | ||
+ | p.id_area AS id_area_goup, | ||
+ | c.id_area | ||
+ | FROM ref_geo.l_areas AS p, ref_geo.l_areas AS c | ||
+ | WHERE p.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND p." | ||
+ | AND c.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND c." | ||
+ | AND starts_with(c.area_code, | ||
+ | | ||
+ | UNION | ||
+ | | ||
+ | SELECT | ||
+ | p.id_area AS id_area_goup, | ||
+ | c.id_area | ||
+ | FROM ref_geo.l_areas AS p, ref_geo.l_areas AS c | ||
+ | WHERE p.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND p." | ||
+ | AND c.id_type = ref_geo.get_id_area_type_by_code(' | ||
+ | AND c." | ||
+ | </ | ||
+ | * Ajout de la colonne '' | ||
+ | ALTER TABLE ref_geo.l_areas ADD COLUMN geom_4326 public.geometry(multipolygon, | ||
+ | |||
+ | |||
+ | CREATE FUNCTION ref_geo.fct_tri_transform_geom() | ||
+ | RETURNS trigger AS | ||
+ | $BODY$ | ||
+ | DECLARE | ||
+ | local_srid integer; | ||
+ | c integer; | ||
+ | BEGIN | ||
+ | IF (TG_OP = ' | ||
+ | -- Insert policy: we set geom from geom_4326 if geom is null and geom_4326 is not null, and reciprocally. | ||
+ | -- If both geom and geom_4326 have been set (or both are null), we do nothing. | ||
+ | IF (NEW.geom IS NULL AND NEW.geom_4326 IS NOT NULL) THEN | ||
+ | NEW.geom = ST_Transform(NEW.geom_4326, | ||
+ | RAISE NOTICE '(I) Updated geom'; | ||
+ | ELSEIF (NEW.geom IS NOT NULL AND NEW.geom_4326 IS NULL) THEN | ||
+ | NEW.geom_4326 = ST_Transform(NEW.geom, | ||
+ | RAISE NOTICE '(I) Updated geom_4326'; | ||
+ | END IF; | ||
+ | ELSEIF (TG_OP = ' | ||
+ | -- Update policy: we set geom from geom_4326 if geom_4326 have been updated to non null value, | ||
+ | -- unless geom have also been modified to non null value, and reciprocally. | ||
+ | -- We also set geom from geom_4326 if geom is modified to null, and geom_4326 is not null (modified or not), | ||
+ | -- in order to be consistent when updating one or two columns at the same time. | ||
+ | IF ( | ||
+ | NEW.geom_4326 IS NOT NULL | ||
+ | AND | ||
+ | ( | ||
+ | (OLD.geom IS NOT DISTINCT FROM NEW.geom AND OLD.geom_4326 IS DISTINCT FROM NEW.geom_4326) | ||
+ | OR | ||
+ | (NEW.geom IS NULL AND OLD.geom IS NOT NULL) | ||
+ | ) | ||
+ | ) THEN | ||
+ | SELECT INTO local_srid Find_SRID(' | ||
+ | NEW.geom = ST_Transform(NEW.geom_4326, | ||
+ | RAISE NOTICE '(U) Updated geom'; | ||
+ | ELSEIF ( | ||
+ | NEW.geom IS NOT NULL | ||
+ | AND | ||
+ | ( | ||
+ | (OLD.geom_4326 IS NOT DISTINCT FROM NEW.geom_4326 AND OLD.geom IS DISTINCT FROM NEW.geom) | ||
+ | OR | ||
+ | (NEW.geom_4326 IS NULL AND OLD.geom_4326 IS NOT NULL) | ||
+ | ) | ||
+ | ) THEN | ||
+ | NEW.geom_4326 = ST_Transform(NEW.geom, | ||
+ | RAISE NOTICE '(U) Updated geom_4326'; | ||
+ | END IF; | ||
+ | END IF; | ||
+ | RETURN NEW; | ||
+ | END; | ||
+ | $BODY$ | ||
+ | LANGUAGE plpgsql VOLATILE | ||
+ | COST 100; | ||
+ | </ | ||
+ | * Ajout de la colonne '' | ||
+ | ALTER TABLE ref_geo.l_areas ADD COLUMN description text NULL; | ||
+ | </ | ||
+ |