Skip to content

Commit

Permalink
End of blurring observation
Browse files Browse the repository at this point in the history
  • Loading branch information
juggler31 committed Feb 14, 2025
1 parent 32d1edf commit c6a0f7c
Show file tree
Hide file tree
Showing 17 changed files with 289 additions and 652 deletions.
1 change: 1 addition & 0 deletions atlas/configuration/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class Meta:
)

AFFICHAGE_MAILLE = fields.Boolean(load_default=False)
AFFICHAGE_COUCHES_MAP = fields.Dict(load_default={})
ZOOM_LEVEL_POINT = fields.Integer(load_default=11)
LIMIT_CLUSTER_POINT = fields.Integer(load_default=1000)
NB_DAY_LAST_OBS = fields.String(load_default="7")
Expand Down
18 changes: 1 addition & 17 deletions atlas/modeles/entities/vmAreas.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,9 @@ class VmAreas(Base):
Column("id_type", Integer(), ForeignKey("atlas.vm_bib_areas_types.id_type")),
Column("the_geom", Geometry("MULTIPOLYGON", 4326), index=True),
Column("area_geojson", Text()),
Column("description", Text()),
schema="atlas",
autoload=True,
autoload_with=db.engine,
extend_existing=True,
)


class VmCorAreaObservation(Base):
__table__ = Table(
"vm_cor_area_observation",
metadata,
Column("id_observation", Integer()),
Column("id_area", Integer()),
schema="atlas",
autoload=True,
autoload_with=db.engine,
extend_existing=True,
primary_key=False,
)
__mapper_args__ = {"primary_key": [__table__.c.id_observation, __table__.c.id_area]}
observation = relationship("VmObservations", foreign_keys=[__table__.c.id_observation])
area = relationship("VmAreas", foreign_keys=[__table__.c.id_area])
322 changes: 0 additions & 322 deletions atlas/modeles/repositories/vmAreasRepository.py

This file was deleted.

21 changes: 11 additions & 10 deletions atlas/modeles/repositories/vmCommunesRepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,20 @@ def getCommunesObservationsChilds(connection, cd_ref):

def getCommunesObservationsChildsMailles(connection, cd_ref):
sql = """
SELECT DISTINCT (com.insee) AS insee, com.commune_maj
FROM atlas.vm_communes com
JOIN atlas.t_mailles_territoire m ON st_intersects(m.the_geom, com.the_geom)
JOIN atlas.vm_observations_mailles obs ON m.id_maille=obs.id_maille
WHERE obs.cd_ref in (
SELECT * from atlas.find_all_taxons_childs(:thiscdref)
)
OR obs.cd_ref = :thiscdref
ORDER BY com.commune_maj ASC
SELECT
DISTINCT vla.area_code AS insee,
vla.area_name
FROM atlas.vm_observations obs
JOIN atlas.vm_cor_area_synthese AS cas ON cas.id_synthese = obs.id_observation
JOIN atlas.vm_l_areas vla ON cas.id_area = vla.id_area
WHERE cas.type_code = 'COM'
AND (obs.cd_ref = ANY(SELECT * FROM atlas.find_all_taxons_childs(:thiscdref) AS taxon_childs(cd_nom))
OR obs.cd_ref = :thiscdref)
ORDER BY vla.area_name ASC;
"""
req = connection.execute(text(sql), thiscdref=cd_ref)
listCommunes = list()
for r in req:
temp = {"insee": r.insee, "commune_maj": r.commune_maj}
temp = {"insee": r.insee, "commune_maj": r.area_name}
listCommunes.append(temp)
return listCommunes
Loading

0 comments on commit c6a0f7c

Please sign in to comment.