-
Notifications
You must be signed in to change notification settings - Fork 49
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
base: to2.0
Are you sure you want to change the base?
Add home territory #587
Conversation
juggler31
commented
Nov 26, 2024
•
edited
Loading
edited
3c5ebf7
to
54d9940
Compare
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
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 | ||
""" |
There was a problem hiding this comment.
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
54d9940
to
abeb1cb
Compare
17b8b5f
to
93a6c03
Compare
@@ -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"]: |
There was a problem hiding this comment.
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
atlas/atlasRoutes.py
Outdated
@@ -158,6 +158,13 @@ def indexMedias(image): | |||
) | |||
|
|||
|
|||
def get_territory_mailles_obs(connection): |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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
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. |
93a6c03
to
e8c0ba9
Compare
Ajout d'une carte territoire ainsi que la liste des espèces sur celui-ci. L'affichage de cette carte est en mailles.
e8c0ba9
to
10d0923
Compare