Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atlas/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def inject_context():
translations=get_tranlated_labels(),
now=now,
timedelta=timedelta,
page_name=request.endpoint.split(".")[1]
)

@app.template_filter("pretty")
Expand Down
4 changes: 2 additions & 2 deletions atlas/atlasRoutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def is_statut_in_groupe(statut, groupe):

@main.route("/<lang_code>/area/<int:id_area>", methods=["GET", "POST"])
@main.route("/area/<int:id_area>", methods=["GET", "POST"])
def ficheArea(id_area):
def area(id_area):
area = vmAreasRepository.getAreaFromIdArea(id_area)
stats_area = vmAreasRepository.getStatsByArea(id_area)
listTaxons = vmTaxonsRepository.getListTaxon(
Expand Down Expand Up @@ -421,7 +421,7 @@ def sitemap():

municipalities = db.session.query(vmAreas.VmAreas).order_by(vmAreas.VmAreas.id_area).all()
for municipalitie in municipalities:
url = url_root + url_for("main.ficheArea", id_area=municipalitie.id_area)
url = url_root + url_for("main.area", id_area=municipalitie.id_area)
modified_time = ten_days_ago
pages.append([url, modified_time])

Expand Down
31 changes: 31 additions & 0 deletions atlas/configuration/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,37 @@ AFFICHAGE_COUCHES_MAP = {
}
}

# Ouvrir le widget par défaut de legende.
DEFAULT_LEGEND_DISPLAY = True

# Ajout des flux wms et geojson

COUCHES_SIG = [
{
"name": "Nom de la couche wms",
"type": "wms",
"url": "url du serveur wms",
"options": {
"layers": 0,
"transparent": True,
"format": "image/png",
"attribution": "",
"wms_version": "1.3.0"
},
"pages": ["index", "area"], // le nom des pages est celui du nom des fonction python des routes (voir atlasRoutes.py)
},
{
"name": "test geojson name",
"type": "geojson",
"url": "Url du geojson",
"style": {
"color": "red",
"weight": 2,
},
"pages": ["index", "area"],
}
]

# Niveau de zoom à partir duquel on passe à l'affichage en point (si AFFICHAGE_MAILLE = False)
ZOOM_LEVEL_POINT = 11

Expand Down
18 changes: 18 additions & 0 deletions atlas/configuration/config_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from marshmallow import (
Schema,
fields,
validate,
validates_schema,
ValidationError,
validates_schema,
Expand Down Expand Up @@ -126,6 +127,21 @@ class MapConfig(Schema):
load_default={"fill": False, "fillColor": "#020202", "fillOpacity": 0.7}
)

class CouchesSigConfig(Schema):
name = fields.Str(required=True)
type = fields.Str(required=True, validate=validate.OneOf(["wms", "geojson"]))
url = fields.Str(required=True)
pages = fields.List(fields.Str(validate=validate.OneOf(["index", "ficheEspece", "area"])))
groups2_inpn = fields.List(fields.Str())
options = fields.Dict()
style = fields.Dict()
wms_version = fields.String()

@validates_schema
def layer_required_for_wms_type(self, data, **kwargs):
if data["type"] == "wms" and (not data.get("options").get("layers") or not data.get("options").get("wms_version")):
raise ValidationError("'layers' and 'wms_version' are required for type 'wms'")


class MediaTypeImportantLink(Schema):
type_media_id = fields.Integer(required=True)
Expand Down Expand Up @@ -285,6 +301,8 @@ class Meta:
load_default="Les observations des agents ces 7 derniers jours |"
)
MAP = fields.Nested(MapConfig, load_default=dict())
DEFAULT_LEGEND_DISPLAY = fields.Boolean(load_default=True)
COUCHES_SIG = fields.List(fields.Nested(CouchesSigConfig), load_default=list())
# coupe le nom_vernaculaire à la 1ere virgule sur les fiches espèces
SPLIT_NOM_VERN = fields.Boolean(load_default=True)
INTERACTIVE_MAP_LIST = fields.Boolean(load_default=True)
Expand Down
Loading
Loading