Skip to content

Add home territory #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: to2.0
Choose a base branch
from
Open

Conversation

juggler31
Copy link

@juggler31 juggler31 commented Nov 26, 2024

Ajout d'une carte territoire ainsi que la liste des espèces sur celui-ci.
L'affichage de cette carte est en mailles.

@juggler31 juggler31 force-pushed the add_home_territory branch 2 times, most recently from 3c5ebf7 to 54d9940 Compare November 26, 2024 14:27
s.id_nomenclature_sensitivity,
st_transform(a.geom, 4326) AS geom
FROM synthese.synthese s
JOIN synthese.tmp_cor_area_synthse sa ON sa.id_synthese = s.id_synthese
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cor_area_synthese et pas tmp_cor_area_synthse

@@ -0,0 +1,45 @@
IMPORT FOREIGN SCHEMA gn_synthese
LIMIT TO (gn_synthese.tmp_cor_area_synthse)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cor_area_synthese et pas tmp_cor_area_synthse

Comment on lines 126 to 139
sql = """
SELECT obs.cd_ref, obs.id_maille, obs.nbr,-- obs.annee, obs.id_observations,
tax.lb_nom, tax.nom_vern, tax.group2_inpn,
medias.url, medias.chemin, medias.id_media,
m.geojson_4326 AS geom,
m.type_code
FROM atlas.vm_observations_mailles obs
JOIN atlas.vm_taxons tax ON tax.cd_ref = obs.cd_ref
JOIN (SELECT DISTINCT id_area, geojson_4326, type_code from atlas.vm_cor_area_synthese) m ON m.id_area=obs.id_maille
LEFT JOIN atlas.vm_medias medias
ON medias.cd_ref = obs.cd_ref AND medias.id_type = 1
GROUP BY obs.cd_ref, obs.id_maille, obs.nbr,
tax.lb_nom, tax.nom_vern, tax.group2_inpn,
medias.url, medias.chemin, medias.id_media,
m.geojson_4326,
m.type_code
"""
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idée d'optimisation:

SELECT obs.cd_ref, obs.id_maille, obs.nbr, obs.type_code,
       tax.lb_nom, tax.nom_vern, tax.group2_inpn,
       medias.url, medias.chemin, medias.id_media,
       st_asgeojson(m.geojson_maille) AS geom
FROM atlas.vm_observations_mailles obs
         JOIN atlas.vm_taxons tax ON tax.cd_ref = obs.cd_ref
         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 = 1
GROUP BY obs.cd_ref, obs.id_maille, obs.nbr,
         tax.lb_nom, tax.nom_vern, tax.group2_inpn,
         medias.url, medias.chemin, medias.id_media,
         m.geojson_maille,
         obs.type_code

@TheoLechemia TheoLechemia changed the base branch from develop to test_PR_Floutage February 24, 2025 14:26
@@ -94,7 +94,12 @@ def getObservationsGenericApi(cd_ref: int):
[type]: [description]
"""
session = db.session
if current_app.config["AFFICHAGE_MAILLE"]:
if current_app.config["AFFICHAGE_TERRITOIRE_OBS"]:
Copy link
Member

@TheoLechemia TheoLechemia Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le fait d'activer la fonctionnalité sur la page d'acceuil ne devrait pas modifié le retour de cette route qui est par ailleurs utilisé sur les fiches espèces.
La fonction getObservationsMaillesChilds est à factorisé et à utiliser dans les deux cas.
Elles sont quasi identiques

@@ -158,6 +158,13 @@ def indexMedias(image):
)


def get_territory_mailles_obs(connection):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug à enlever

[
Feature(
id=o.id_maille,
geojson_maille=json.loads(o.geojson_maille),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le geojson renvoyé par cette fonction n'est pas "valide" . La géométrie est dans properties et non dans l'attribut geometry.
De manière général, c'est un duplicat de la fonction getObservationsMaillesChilds dont l'utilisation est à priviligier

@TheoLechemia
Copy link
Member

TheoLechemia commented Feb 26, 2025

L'ajout de cette fonctionnalité alourdi très fortement le chargement initial de la page d’accueil. Plus de 10sec de chargement avec écran blanc pour une base avec 9000 espèces.
Pour arriver à un fonctionnement acceptable, le chargement des observations devrait se faire en asynchrone comme c'est le cas sur les fiches espèces.
Je questionne aussi la pertinence d'afficher une liste déroulante de 9000 espèces sans pagination ?

@juggler31 juggler31 force-pushed the add_home_territory branch from 93a6c03 to e8c0ba9 Compare March 3, 2025 14:28
Ajout d'une carte territoire ainsi que la liste des espèces sur celui-ci.
L'affichage de cette carte est en mailles.
@juggler31 juggler31 force-pushed the add_home_territory branch from e8c0ba9 to 10d0923 Compare March 3, 2025 14:30
@TheoLechemia TheoLechemia changed the base branch from test_PR_Floutage to to2.0 March 11, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants