bretagne-vivante / geonature Goto Github PK
View Code? Open in Web Editor NEWThis project forked from pnx-si/geonature
Application de saisie et de synthèse des observations faune et flore
License: GNU General Public License v3.0
This project forked from pnx-si/geonature
Application de saisie et de synthèse des observations faune et flore
License: GNU General Public License v3.0
https://taxref.mnhn.fr/taxref-web/accueil
https://taxref.mnhn.fr/taxref-web/api/doc
https://agroportal.lirmm.fr/ontologies/TAXREF-LD
http://lod.taxonconcept.org/ontology/txn.owl#RankSpecies
http://lod.taxonconcept.org/ontology/txn.owl
http://taxref.i3s.unice.fr/describe/?url=http://taxref.mnhn.fr/lod/taxrank/Species
https://taxref.mnhn.fr/api/taxa/4460
https://taxref.mnhn.fr/api/taxa/4460/status/lines
https://taxref.mnhn.fr/api/taxa/4460/factsheet
https://taxref.mnhn.fr/api/taxa/4460/taxrefHistory
https://taxref.mnhn.fr/api/taxa/2623/interactions
https://taxref.mnhn.fr/api/taxa/4460/externalIds
http://taxref.mnhn.fr/lod/taxon/4460
https://taxref.mnhn.fr/api/taxa/4460/media
https://taxref.mnhn.fr/api/media/download/inpn/389335
https://inpn.mnhn.fr/photos/uploads/webtofs/inpn/3/403013.jpg
attention /x/ est variable et ne correspond pas a l'affichage sur le site inpn
Version
Version de GeoNature 2.13.0
Description du bug
module pop reptile et amphibien
Non affichage des noms verns des espèces lorsqu'il y a un accent
Comportement attendue
affichage du vern avec accent
exemple pour pop
crapaud épineux ou triton alpestre
Version
Version de GeoNature affectée par le bug.
Description du bug
Absence du type de financement dans la page de métadonnées
Comportement attendue
Affichage du type de financement dans la page de métadonnées dans sa section
Comment reproduire
page metadata/dataset_detail
Logs
Extrait du fichier /var/log/geonature.log
dans le cas d’une erreur 500.
<div class="a" data-qa='pnx-metadata-acq-framework-id'> <b> Identifiant GeoNature du cadre d'acquisition :</b>
{{af?.id_acquisition_framework}}</div>
<b> Etendue territoriale : </b>{{ af?.nomenclature_territorial_level?.label_default }}
</div>
<div class="b">Créateur</div>
<div class="a">
<b> Créateur du cadre d'acquisition :</b>
{{ af?.creator?.nom_complet || 'Non renseigné' }}
</div>
<div class="b">Type de financement :</div>
<div class="a">
<b> Financement :</b>
{{ af?.nomenclature_financing_type?.label_default }}
</div>
Version
2.13.4
Description du bug
error API sur login + taxhub
https://taxhub.bretagne-vivante.org/api/taxref/allnamebylist/101
non fonctionnel -> error 500
Comportement attendu
Description du comportement attendu en lieu et place du problème rencontré.
Comment reproduire
Étapes à suivre pour reproduire le problème (sur quelle page se rendre, sur quel bouton cliquer, avec quelles données présentes, …).
Logs
Extrait du fichier /var/log/geonature.log
dans le cas d’une erreur 500.
[Fri Feb 16 12:15:53.393527 2024] [proxy_http:error] [pid 32971:tid 140286911047424]
[client 192.168.30.2:51318] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: https://geonature.bretagne-vivante.org/
https://serverfault.com/questions/965602/apache-2-4-proxy-httperror-proxyerror
PnX-SI#2521
https://wiki-sinp.cbn-alpin.fr/serveurs/installation/hosts-hostname
Ce que doit comporter cet export :
anonymiser les observateurs, les validateurs et supprimer les colonnes commentaires.
la geom calculée par la sensibilité
la vue de base est v_synthese_for_export et gn_synthese.synthese
extrait des données des communes pour la période 2000-2023 pour les données sous statut "certain-très probable" ou "probable" (19 799 observations). Pour un projet d'ABC à l'échelle de ces communes. On a conventionné
a tester
SELECT
s.id_synthese,
COALESCE(a.geom, s.the_geom_4326) AS geom
FROM
gn_synthese.synthese s
JOIN ref_nomenclatures.t_nomenclatures sensitivity
ON s.id_nomenclature_sensitivity = sensitivity.id_nomenclature
LEFT JOIN (
gn_synthese.cor_area_synthese cas
JOIN ref_geo.l_areas a ON a.id_area = cas.id_area
JOIN ref_geo.bib_areas_types bat ON bat.id_type = a.id_type
JOIN gn_sensitivity.cor_sensitivity_area_type sat ON bat.id_type = sat.id_area_type
) ON
cas.id_synthese = s.id_synthese
AND s.id_nomenclature_sensitivity = sat.id_nomenclature_sensitivity
WHERE sensitivity.cd_nomenclature != '4';
source PnX-SI#2558
Ces vues doivent obligatoirement avoir une colonne id_synthese, une colonne geojson_local représentant le geojson de la géometrie en projection locale (pour la génération du shapefile et geopackage) et une colonne geojson_4326 représentant le geojson de la géométrie en projection 4326 (pour la génération du geojson) (utilisez la fonction st_asgeojson - voir la vue par défaut gn_synthese.v_synthese_for_export)
CREATE OR REPLACE VIEW gn_synthese.v_synthese_for_export_floutage
AS SELECT s.id_synthese,
s.date_min::date AS date_debut,
s.date_max::date AS date_fin,
-- s.date_min::time without time zone AS heure_debut, -- non complété
-- s.date_max::time without time zone AS heure_fin, -- non complété
t.cd_nom,
t.cd_ref,
t.nom_valide,
t.nom_vern AS nom_vernaculaire,
s.nom_cite,
t.regne,
t.group1_inpn,
t.group2_inpn,
t.group3_inpn,
t.classe,
t.ordre,
t.famille,
t.id_rang AS rang_taxo,
s.count_min AS nombre_min,
s.count_max AS nombre_max,
s.altitude_min AS alti_min,
s.altitude_max AS alti_max,
-- s.depth_min AS prof_min, -- non complété
-- s.depth_max AS prof_max, -- non complété
-- s.observers AS observateurs, -- anonymisation
s.id_digitiser,
-- s.determiner AS determinateur, -- anonymisation
sa.communes,
coalesce (st_astext(floutage.geom),st_astext(s.the_geom_4326)) AS geometrie_wkt_4326,
-- st_x(s.the_geom_point) AS x_centroid_4326,
-- st_y(s.the_geom_point) AS y_centroid_4326,
coalesce (st_asgeojson(s.the_geom_4326) , st_asgeojson(floutage.geom)) AS geojson_4326,
coalesce (st_asgeojson(s.the_geom_4326), st_asgeojson(floutage.geom)) AS geojson_local,
s.place_name AS nom_lieu,
-- s.comment_context AS comment_releve, -- anonymisation
-- s.comment_description AS comment_occurrence, -- anonymisation
-- s.validator AS validateur, -- anonymisation
n21.label_default AS niveau_validation,
s.meta_validation_date AS date_validation,
-- s.validation_comment AS comment_validation, -- anonymisation
s.digital_proof AS preuve_numerique_url,
s.non_digital_proof AS preuve_non_numerique,
d.dataset_name AS jdd_nom,
d.unique_dataset_id AS jdd_uuid,
-- d.id_dataset AS jdd_id, -- inutile
af.acquisition_framework_name AS ca_nom,
af.unique_acquisition_framework_id AS ca_uuid,
-- d.id_acquisition_framework AS ca_id, -- inutile
s.cd_hab AS cd_habref,
hab.lb_code AS cd_habitat,
hab.lb_hab_fr AS nom_habitat,
s."precision" AS precision_geographique,
n1.label_default AS nature_objet_geo,
n2.label_default AS type_regroupement,
s.grp_method AS methode_regroupement,
n3.label_default AS technique_observation,
n5.label_default AS biologique_statut,
n6.label_default AS etat_biologique,
n22.label_default AS biogeographique_statut,
n7.label_default AS naturalite,
n8.label_default AS preuve_existante,
n9.label_default AS niveau_precision_diffusion,
n10.label_default AS stade_vie,
n11.label_default AS sexe,
n12.label_default AS objet_denombrement,
n13.label_default AS type_denombrement,
n14.label_default AS niveau_sensibilite,
n15.label_default AS statut_observation,
-- n16.label_default AS floutage_dee, -- données floutées dans le UNION
n17.label_default AS statut_source,
n18.label_default AS type_info_geo,
n19.label_default AS methode_determination,
n20.label_default AS comportement,
-- s.reference_biblio, -- anonymisation car url faune
-- s.entity_source_pk_value AS id_origine, --inutile
s.unique_id_sinp AS uuid_perm_sinp,
s.unique_id_sinp_grp AS uuid_perm_grp_sinp,
s.meta_create_date AS date_creation,
-- s.meta_update_date AS date_modification, -- redondant
-- s.additional_data AS champs_additionnels, -- anonymisation
COALESCE(s.meta_update_date, s.meta_create_date) AS derniere_action
FROM gn_synthese.synthese s
JOIN taxonomie.taxref t ON t.cd_nom = s.cd_nom
JOIN gn_meta.t_datasets d ON d.id_dataset = s.id_dataset
JOIN gn_meta.t_acquisition_frameworks af ON d.id_acquisition_framework = af.id_acquisition_framework
LEFT JOIN ( SELECT cas.id_synthese,
string_agg(DISTINCT a_1.area_name::text, ', '::text) AS communes
FROM gn_synthese.cor_area_synthese cas
LEFT JOIN ref_geo.l_areas a_1 ON cas.id_area = a_1.id_area
JOIN ref_geo.bib_areas_types ta ON ta.id_type = a_1.id_type AND ta.type_code::text = 'COM'::text
GROUP BY cas.id_synthese) sa ON sa.id_synthese = s.id_synthese
LEFT JOIN ref_nomenclatures.t_nomenclatures n1 ON s.id_nomenclature_geo_object_nature = n1.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n2 ON s.id_nomenclature_grp_typ = n2.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n3 ON s.id_nomenclature_obs_technique = n3.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n5 ON s.id_nomenclature_bio_status = n5.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n6 ON s.id_nomenclature_bio_condition = n6.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n7 ON s.id_nomenclature_naturalness = n7.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n8 ON s.id_nomenclature_exist_proof = n8.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n9 ON s.id_nomenclature_diffusion_level = n9.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n10 ON s.id_nomenclature_life_stage = n10.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n11 ON s.id_nomenclature_sex = n11.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n12 ON s.id_nomenclature_obj_count = n12.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n13 ON s.id_nomenclature_type_count = n13.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n14 ON s.id_nomenclature_sensitivity = n14.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n15 ON s.id_nomenclature_observation_status = n15.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n16 ON s.id_nomenclature_blurring = n16.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n17 ON s.id_nomenclature_source_status = n17.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n18 ON s.id_nomenclature_info_geo_type = n18.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n19 ON s.id_nomenclature_determination_method = n19.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n20 ON s.id_nomenclature_behaviour = n20.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n21 ON s.id_nomenclature_valid_status = n21.id_nomenclature
LEFT JOIN ref_nomenclatures.t_nomenclatures n22 ON s.id_nomenclature_biogeo_status = n22.id_nomenclature
LEFT JOIN ref_habitats.habref hab ON hab.cd_hab = s.cd_hab
-- Jointure Calcul geom floutée
LEFT JOIN LATERAL (
SELECT
COALESCE(ST_Transform(a.geom,4326), s.the_geom_4326) AS geom
FROM
gn_synthese.cor_area_synthese cas
JOIN ref_geo.l_areas a ON a.id_area = cas.id_area
JOIN ref_geo.bib_areas_types bat ON bat.id_type = a.id_type
JOIN gn_sensitivity.cor_sensitivity_area_type sat ON bat.id_type = sat.id_area_type
WHERE
cas.id_synthese = s.id_synthese
AND s.id_nomenclature_sensitivity = sat.id_nomenclature_sensitivity
LIMIT 1
) floutage ON TRUE
WHERE -- règles floutage
-- validation certaine et probable
s.id_nomenclature_valid_status in (ref_nomenclatures.get_id_nomenclature('STATUT_VALID', '1'), ref_nomenclatures.get_id_nomenclature('STATUT_VALID', '2') )
and
-- non diffusion mm floutée
s.id_nomenclature_diffusion_level != ref_nomenclatures.get_id_nomenclature('NIV_PRECIS', '4') -- Aucune diffusion
and
s.id_nomenclature_sensitivity != ref_nomenclatures.get_id_nomenclature('SENSIBILITE', '4') --Aucune diffusion
;
GRANT SELECT ON TABLE gn_synthese.v_synthese_for_export_floutage TO geonatadmin;
--------
-- Tests
select distinct ST_SRID(geom) from ref_geo.l_areas
SELECT
s.id_synthese,
ST_SRID(COALESCE(ST_Transform(a.geom,4326), s.the_geom_4326)) AS geom
FROM
gn_synthese.synthese s
JOIN ref_nomenclatures.t_nomenclatures sensitivity
ON s.id_nomenclature_sensitivity = sensitivity.id_nomenclature
LEFT JOIN (
gn_synthese.cor_area_synthese cas
JOIN ref_geo.l_areas a ON a.id_area = cas.id_area
JOIN ref_geo.bib_areas_types bat ON bat.id_type = a.id_type
JOIN gn_sensitivity.cor_sensitivity_area_type sat ON bat.id_type = sat.id_area_type
) ON
cas.id_synthese = s.id_synthese
AND s.id_nomenclature_sensitivity = sat.id_nomenclature_sensitivity
WHERE sensitivity.cd_nomenclature != '4';
[SYNTHESE]
...
# Export custom dans synthese
EXPORT_OBSERVATIONS_CUSTOM_VIEWS = [
{
label = "Export obs certaine/probable avec anonymisation et floutage",
view_name = "gn_synthese.v_synthese_for_export_floutage",
},
]
a retravailler, travail presque abouti sur shiny
create view gn_exports.v_ref_geo_commune_api as
select st_asgeojson(data.*)
from (
select id_area, area_name , area_code , geom
from ref_geo.l_areas la
where id_type = 25
--and area_code ilike '56007'
)data
https://geonature.bretagne-vivante.org/api/exports/api/6
https://geonature.bretagne-vivante.org/api/exports/api/7
https://taxhub.bretagne-vivante.org/#!/listes/107
https://taxhub.bretagne-vivante.org/api/taxref/allnamebylist/107
https://geonature.bretagne-vivante.org/api/exports/api/7
avec variable
https://geonature.bretagne-vivante.org/api/exports/api/7?limit=1000&offset=1000&geojson=geojson
https://shiny.posit.co/r/articles/build/layout-guide/
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/paste
https://www.digitalocean.com/community/tutorials/paste-in-r
https://stackoverflow.com/questions/5738831/r-plus-equals-and-plus-plus-equivalent-from-c-c-java-etc
https://stackoverflow.com/questions/51143588/convert-string-into-json-string-and-parsing-in-r
https://www.math.ucla.edu/~anderson/rw1001/library/base/html/character.html
https://www.w3schools.com/r/r_while_loop.asp
https://sparkbyexamples.com/r-programming/r-create-an-empty-dataframe/
https://stackoverflow.com/questions/26508519/how-to-add-elements-to-a-list-in-r-loop
https://statisticsglobe.com/merge-multiple-data-frames-of-list-in-r
https://cran.r-project.org/web/packages/geojsonR/geojsonR.pdf
https://community.rstudio.com/t/fromjson-in-shiny-app/68306/3
https://cran.r-project.org/web/packages/geojsonR/vignettes/the_geojsonR_package.html
https://rstudio.github.io/leaflet/json.html
https://cran.r-project.org/web/packages/jsonlite/vignettes/json-paging.html
https://www.flother.is/til/postgis-geojson/
https://jsonlint.com/
https://stackoverflow.com/questions/37933084/how-to-display-multiple-polygons-at-once-using-leaflet-addgeojson-function
https://www.tutorialspoint.com/r/r_json_files.htm
https://community.rstudio.com/t/fromjson-in-shiny-app/68306/4
https://datatracker.ietf.org/doc/pdf/rfc7946.pdf#page=5
https://cran.r-project.org/web/packages/geojsonsf/vignettes/geojson-sf-conversions.html
https://datatofish.com/remove-column-dataframe-r/
https://stackoverflow.com/questions/47191727/r-filtering-by-two-columns-using-is-not-equal-operator-dplyr-subset
https://stackoverflow.com/questions/60129630/special-symbols-pattern-search-with-str-detect
https://stackoverflow.com/questions/22850026/filter-rows-which-contain-a-certain-string/40233929#40233929
https://tidyselect.r-lib.org/reference/starts_with.html
https://stackoverflow.com/questions/74019414/r-how-to-filter-rows-where-the-start-of-entries-match-a-list
https://stackoverflow.com/questions/47789632/customizing-leaflet-popup-in-r
https://rstudio.github.io/leaflet/json.html
https://stackoverflow.com/questions/29480795/add-polygons-to-r-shiny-leaflet-map
https://rdrr.io/cran/geoops/man/FeatureCollection.html
https://cran.r-project.org/web/packages/sf/vignettes/sf2.html
https://r-graph-gallery.com/38-rcolorbrewers-palettes.html
https://www.rdocumentation.org/packages/leaflet.extras/versions/1.0.0/topics/addHeatmap
https://www.rdocumentation.org/packages/leaflet/versions/2.2.0/topics/colorNumeric
https://www.r-bloggers.com/2012/10/palettes-in-r/
https://stackoverflow.com/questions/51931610/r-leaflet-fill-polygons-with-colours
http://rstudio.github.io/leaflet/legends.html
https://leafletjs.com/examples/layers-control/
https://stackoverflow.com/questions/50641092/r-leaflet-map-change-legends-based-on-selected-layer-group
https://stackoverflow.com/questions/65572493/how-to-turn-off-the-layer-display-of-addlayerscontrol-first-when-launching-the-s
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.