From 46926f419282ced832b66a70113e11bb6802e157 Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Thu, 21 Nov 2024 12:42:11 +0100 Subject: [PATCH 1/9] fix(gpu): remove static maps and replace explorer --- carto/templates/carto/map_libre.html | 7 + config/settings.py | 4 + project/admin.py | 5 - project/apps.py | 3 +- ...oject_async_theme_map_gpu_done_and_more.py | 29 ++++ project/models/create.py | 2 - project/models/project_base.py | 12 +- project/tasks/project.py | 59 ------- .../project/components/dashboard/gpu.html | 159 +++++++++--------- templates/index.html | 4 +- 10 files changed, 121 insertions(+), 163 deletions(-) create mode 100644 project/migrations/0102_remove_historicalproject_async_theme_map_gpu_done_and_more.py diff --git a/carto/templates/carto/map_libre.html b/carto/templates/carto/map_libre.html index 0104480e3..31620aa12 100644 --- a/carto/templates/carto/map_libre.html +++ b/carto/templates/carto/map_libre.html @@ -8,6 +8,13 @@ {% load highcharts_tags %} {% load sri %} +{% block top_navigation %} +{% endblock top_navigation %} + +{% block title %} +{{ map_name }} +{% endblock title %} + {% block pagetitle %} {{ map_name }} {% endblock pagetitle %} diff --git a/config/settings.py b/config/settings.py index 97b46fbec..f46aa6175 100644 --- a/config/settings.py +++ b/config/settings.py @@ -660,3 +660,7 @@ def show_toolbar(request): # CRISP CRISP_WEBHOOK_SECRET_KEY = env.str("CRISP_WEBHOOK_SECRET_KEY") + +X_FRAME_OPTIONS = "SAMEORIGIN" + +XS_SHARING_ALLOWED_METHODS = ["POST", "GET", "OPTIONS", "PUT", "DELETE"] diff --git a/project/admin.py b/project/admin.py index 2a6cb23f7..b023d7f64 100644 --- a/project/admin.py +++ b/project/admin.py @@ -74,11 +74,6 @@ def response_change(self, request, obj): messages.add_message(request, messages.INFO, msg) return HttpResponseRedirect(".") - elif "_generate-gpu" in request.POST: - tasks.generate_theme_map_gpu.delay(obj.id) - messages.add_message(request, messages.INFO, "Génération de l'image des zonages d'urbanismes en cours") - return HttpResponseRedirect(".") - elif "_generate-fill-gpu" in request.POST: tasks.generate_theme_map_fill_gpu.delay(obj.id) messages.add_message( diff --git a/project/apps.py b/project/apps.py index 6db3d63a2..a18100217 100644 --- a/project/apps.py +++ b/project/apps.py @@ -4,8 +4,7 @@ def pre_create_historical_record_callback(sender, **kwargs): project_history = kwargs["history_instance"] - if project_history.async_theme_map_gpu_done is None: - project_history.async_theme_map_gpu_done = False + if project_history.async_theme_map_fill_gpu_done is None: project_history.generate_theme_map_fill_gpu = False diff --git a/project/migrations/0102_remove_historicalproject_async_theme_map_gpu_done_and_more.py b/project/migrations/0102_remove_historicalproject_async_theme_map_gpu_done_and_more.py new file mode 100644 index 000000000..e9db0d4b6 --- /dev/null +++ b/project/migrations/0102_remove_historicalproject_async_theme_map_gpu_done_and_more.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.13 on 2024-11-21 10:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("public_data", "0191_landconso_landconsocomparison_landconsostats_landpop_and_more"), + ("project", "0101_remove_projectcommune_commune_insee"), + ] + + operations = [ + migrations.RemoveField( + model_name="historicalproject", + name="async_theme_map_gpu_done", + ), + migrations.RemoveField( + model_name="historicalproject", + name="theme_map_gpu", + ), + migrations.RemoveField( + model_name="project", + name="async_theme_map_gpu_done", + ), + migrations.RemoveField( + model_name="project", + name="theme_map_gpu", + ), + ] diff --git a/project/models/create.py b/project/models/create.py index 3e039dae6..8afc91e40 100644 --- a/project/models/create.py +++ b/project/models/create.py @@ -39,8 +39,6 @@ def map_tasks(project_id: str) -> List[celery.Task]: # noqa: C901 map_tasks.append(tasks.generate_theme_map_understand_artif.si(project.id)) if project.has_complete_uniform_ocsge_coverage and project.has_zonage_urbanisme: - if not project.async_theme_map_gpu_done: - map_tasks.append(tasks.generate_theme_map_gpu.si(project.id)) if not project.async_theme_map_fill_gpu_done: map_tasks.append(tasks.generate_theme_map_fill_gpu.si(project.id)) diff --git a/project/models/project_base.py b/project/models/project_base.py index 2d89eb797..da253eace 100644 --- a/project/models/project_base.py +++ b/project/models/project_base.py @@ -278,13 +278,6 @@ def get_public_key(self) -> str: storage=PublicMediaStorage(), ) - theme_map_gpu = models.ImageField( - upload_to=upload_in_project_folder, - blank=True, - null=True, - storage=PublicMediaStorage(), - ) - theme_map_fill_gpu = models.ImageField( upload_to=upload_in_project_folder, blank=True, @@ -307,7 +300,6 @@ def get_public_key(self) -> str: async_generate_theme_map_conso_done = models.BooleanField(default=False) async_generate_theme_map_artif_done = models.BooleanField(default=False) async_theme_map_understand_artif_done = models.BooleanField(default=False) - async_theme_map_gpu_done = models.BooleanField(default=False) async_theme_map_fill_gpu_done = models.BooleanField(default=False) async_ocsge_coverage_status_done = models.BooleanField(default=False) @@ -348,9 +340,7 @@ def async_complete(self) -> bool: static_maps_ready = static_maps_ready and self.async_theme_map_understand_artif_done if self.has_zonage_urbanisme and self.has_complete_uniform_ocsge_coverage: - static_maps_ready = ( - static_maps_ready and self.async_theme_map_gpu_done and self.async_theme_map_fill_gpu_done - ) + static_maps_ready = static_maps_ready and self.async_theme_map_fill_gpu_done return calculations_and_extend_ready and static_maps_ready diff --git a/project/tasks/project.py b/project/tasks/project.py index 5a944edc1..a9cb2e553 100644 --- a/project/tasks/project.py +++ b/project/tasks/project.py @@ -695,65 +695,6 @@ def generate_theme_map_understand_artif(self, project_id) -> None: logger.info("End generate_theme_map_understand_artif, project_id=%d", project_id) -@shared_task(bind=True, max_retries=5) -def generate_theme_map_gpu(self, project_id) -> None: - logger.info("Start generate_theme_map_gpu, project_id=%d", project_id) - try: - diagnostic = Project.objects.get(id=int(project_id)) - - geom = diagnostic.combined_emprise.transform("3857", clone=True) - srid, wkt = geom.ewkt.split(";") - polygons = shapely.wkt.loads(wkt) - gdf_emprise = geopandas.GeoDataFrame({"geometry": [polygons]}, crs="EPSG:3857") - - data = {"color": [], "geometry": []} - - for zone_urba in ZoneUrba.objects.intersect(diagnostic.combined_emprise): - srid, wkt = zone_urba.intersection.ewkt.split(";") - polygons = shapely.wkt.loads(wkt) - data["geometry"].append(polygons) - data["color"].append((*[_ / 255 for _ in zone_urba.get_color()], 0.9)) - - zone_urba_gdf = geopandas.GeoDataFrame(data, crs="EPSG:4326").to_crs(epsg=3857) - - fig, ax = plt.subplots(figsize=(15, 10)) - plt.axis("off") - fig.set_dpi(150) - - zone_urba_gdf.plot(ax=ax, color=zone_urba_gdf["color"]) - gdf_emprise.plot(ax=ax, facecolor="none", edgecolor="black") - ax.add_artist(ScaleBar(1)) - ax.set_title( - f"Les zones d'urbanisme du territoire «{diagnostic.territory_name}» en {diagnostic.analyse_end_date}" - ) - cx.add_basemap(ax, source=settings.OPENSTREETMAP_URL) - cx.add_attribution(ax, text=settings.OPENSTREETMAP_ATTRIBUTION) - - img_data = io.BytesIO() - plt.savefig(img_data, bbox_inches="tight", format="jpg") - plt.close() - img_data.seek(0) - - race_protection_save_map( - diagnostic.pk, - "async_theme_map_gpu_done", - "theme_map_gpu", - f"theme_map_gpu_{project_id}.jpg", - img_data, - ) - - except Project.DoesNotExist: - logger.error(f"project_id={project_id} does not exist") - - except Exception as exc: - logger.error(exc) - logger.exception(exc) - self.retry(exc=exc, countdown=300) - - finally: - logger.info("End generate_theme_map_gpu, project_id=%d", project_id) - - @shared_task(bind=True, max_retries=5) def generate_theme_map_fill_gpu(self, project_id) -> None: logger.info("Start generate_theme_map_fill_gpu, project_id=%d", project_id) diff --git a/project/templates/project/components/dashboard/gpu.html b/project/templates/project/components/dashboard/gpu.html index a8f3b1141..7f2fb27b2 100644 --- a/project/templates/project/components/dashboard/gpu.html +++ b/project/templates/project/components/dashboard/gpu.html @@ -1,97 +1,90 @@ -
-

Découvrez notre explorateur des zonages d'urbanisme

-

- Croisez les zonages d'urbanisme avec les données de l'OCS GE afin de comprendre l'artificialisation de votre territoire. -

- - - -
- -
-

Synthèse des zonages d'urbanisme

+

Synthèse

-
-
-
-
-
-
-
- - - - - - - - - - - - - - {% for zone_type, zone in zone_list.items %} - - - - - - - - - {% endfor %} - -
- Données synthèse des zonages d'urbanisme -
Type de
zone
Nombre
de zones
Surface
totale
Surface
artificielle ({{ last_year_ocsge }})
Taux d'artificialisation
({{ last_year_ocsge }})
Artificialisation
({{ first_year_ocsge }} à {{ last_year_ocsge }})
{{ zone_type }}{{ zone.nb_zones }}{{ zone.total_area|floatformat:1 }} ha{{ zone.last_artif_area|floatformat:1 }} ha -
-
-
{{ zone.fill_up_rate|floatformat:1 }}%
-
-
{{ zone.new_artif|floatformat:1 }} ha
-
+
+
+
+
+
+
+
+ + + + + + + + + + + + + {% for zone_type, zone in zone_list.items %} + + + + + + + + + {% endfor %} + +
Type de
zone
Nombre
de zones
Surface
totale
Surface
artificielle ({{ last_year_ocsge }})
Taux d'artificialisation
({{ last_year_ocsge }})
Artificialisation
({{ first_year_ocsge }} à {{ last_year_ocsge }})
{{ zone_type }}{{ zone.nb_zones }}{{ zone.total_area|floatformat:1 }} ha{{ zone.last_artif_area|floatformat:1 }} ha +
+
+
{{ zone.fill_up_rate|floatformat:1 }}%
+
+
{{ zone.new_artif|floatformat:1 }} ha
+
+ +

Les types de zone d'après le Standard CNIG PLU v2022 - rev. octobre 2022: +
U : zone urbaine +
AUc : zone à urbaniser +
AUs : zone à urbaniser bloquée +
A : zone agricole +
N : zone naturelle +

+
+
+ + + +
-

Les types de zone d'après le Standard CNIG PLU v2022 - rev. octobre 2022: -
U : zone urbaine -
AUc : zone à urbaniser -
AUs : zone à urbaniser bloquée -
A : zone agricole -
N : zone naturelle +

+
+
+
+ + Source de données: +

+ OCS GE

+
+
+
Source
+

Données d'OCcupation des Sols à Grande Echelle (OCS GE) de l'IGN, sur la période d'analyse. Zonages d'Urbanisme issus du Géoportail de l'Urbanisme (GPU) en date de juin 2023: https://www.geoportail-urbanisme.gouv.fr/

-
- {% include "project/components/widgets/static_map.html" with static_map=diagnostic.theme_map_gpu title="Carte présentant les zonages d'urbanisme du territoire" %} +
Calcul
+

Qualifier l'artificialisation de chaque parcelle OCS GE via la matrice d'artficialisation (consulter). Puis comparer la surface totale des parcelles artificialisées dans chaque zonage d'urbanisme à la surface de la zone pour connaître le taux d'occupation.

-
+
-
-
-
-
- - Source de données: -

- OCS GE -

-
- -
-
-
Source
-

Données d'OCcupation des Sols à Grande Echelle (OCS GE) de l'IGN, sur la période d'analyse. Zonages d'Urbanisme issus du Géoportail de l'Urbanisme (GPU) en date de juin 2023: https://www.geoportail-urbanisme.gouv.fr/

- -
Calcul
-

Qualifier l'artificialisation de chaque parcelle OCS GE via la matrice d'artficialisation (consulter). Puis comparer la surface totale des parcelles artificialisées dans chaque zonage d'urbanisme à la surface de la zone pour connaître le taux d'occupation.

-
+

Explorateur

+ + +
+
+
+
-
+ +
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 4a14f51b1..46c60ab7c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,7 +39,9 @@
- {% include "header.html" %} + {% block top_navigation %} + {% include "header.html" %} + {% endblock top_navigation %}
From 2e40c5b8db9488570b0df77bdf79b63ba1d8c61f Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Thu, 21 Nov 2024 14:55:43 +0100 Subject: [PATCH 2/9] fix(gpu): reduce size of title --- .../templates/project/components/charts/artif_zone_urba.html | 2 +- project/templates/project/components/dashboard/gpu.html | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/project/templates/project/components/charts/artif_zone_urba.html b/project/templates/project/components/charts/artif_zone_urba.html index 187f127b4..1fd639937 100644 --- a/project/templates/project/components/charts/artif_zone_urba.html +++ b/project/templates/project/components/charts/artif_zone_urba.html @@ -1,5 +1,5 @@
-

Détail de la zone urbaine

+

Détail de la zone urbaine

  • Surface de la zone: {{ surface|floatformat:1 }} ha

    diff --git a/project/templates/project/components/dashboard/gpu.html b/project/templates/project/components/dashboard/gpu.html index 7f2fb27b2..1f93f6df7 100644 --- a/project/templates/project/components/dashboard/gpu.html +++ b/project/templates/project/components/dashboard/gpu.html @@ -83,8 +83,7 @@

    Explorateur

    - +
    -
    \ No newline at end of file From 4bcb10b44ccc1aaebd97ab7903e9a39375ddd18d Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Mon, 25 Nov 2024 10:19:36 +0100 Subject: [PATCH 3/9] feat(*): make maplibre maps iframe --- .../dashboard/artificialisation.html | 15 +++++++++++---- .../components/dashboard/consommation.html | 19 +++++++++++++------ .../project/components/dashboard/gpu.html | 9 ++++++++- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/project/templates/project/components/dashboard/artificialisation.html b/project/templates/project/components/dashboard/artificialisation.html index 89a7bda5e..c641eb399 100644 --- a/project/templates/project/components/dashboard/artificialisation.html +++ b/project/templates/project/components/dashboard/artificialisation.html @@ -147,7 +147,7 @@

    Aperçu de l'artificialisation

    Evolution de l'artificialisation entre {{ first_millesime }} et {{ last_millesime }}

    -
    +
    {% include "project/components/widgets/chart_buttons.html" with chart="chart_waterfall" %} @@ -155,9 +155,16 @@

    Evolution de l'artificialisation entre {{ first_millesime }} et {{ last_mill

    -
    - {% url 'project:theme-my-artif' project.pk as dynamic_map_url %} - {% include "project/components/widgets/static_map.html" with dynamic_map_url=dynamic_map_url static_map=project.theme_map_understand_artif title="Carte comprendre l'artificialisation de son territoire" %} +
    +
    +
    +
    diff --git a/project/templates/project/components/dashboard/consommation.html b/project/templates/project/components/dashboard/consommation.html index 7a3ef0ff6..eab0fd62b 100644 --- a/project/templates/project/components/dashboard/consommation.html +++ b/project/templates/project/components/dashboard/consommation.html @@ -13,7 +13,7 @@

    Consommation d'espace annuelle sur le territoire

    -
    +
    {% include "project/components/widgets/chart_buttons.html" with chart="annual_total_conso_chart" %} @@ -22,13 +22,20 @@

    Consommation d'espace annuelle sur le territoire

    - {% if not is_commune %} -
    - {% url 'project:theme-city-conso' project.pk as dynamic_map_url %} - {% include "project/components/widgets/static_map.html" with dynamic_map_url=dynamic_map_url static_map=project.theme_map_conso title="Carte consommation d'espaces des communes du territoire sur la période (en ha)" %} +
    + {% if not is_commune %} +
    +
    +
    - {% endif %}
    + {% endif %}
    diff --git a/project/templates/project/components/dashboard/gpu.html b/project/templates/project/components/dashboard/gpu.html index 1f93f6df7..02b29d569 100644 --- a/project/templates/project/components/dashboard/gpu.html +++ b/project/templates/project/components/dashboard/gpu.html @@ -83,7 +83,14 @@

    Explorateur

    - +
    \ No newline at end of file From 7312876c9965fa2f01688cba408bc0ed7fe1a50f Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Mon, 25 Nov 2024 15:19:07 +0100 Subject: [PATCH 4/9] t --- .../templates/project/components/dashboard/gpu.html | 10 ++-------- .../templates/project/components/map/iframe_map.html | 9 +++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 project/templates/project/components/map/iframe_map.html diff --git a/project/templates/project/components/dashboard/gpu.html b/project/templates/project/components/dashboard/gpu.html index 02b29d569..475a2fd66 100644 --- a/project/templates/project/components/dashboard/gpu.html +++ b/project/templates/project/components/dashboard/gpu.html @@ -83,14 +83,8 @@

    Explorateur

    - + {% url 'project:map-urban-zones' project.pk as map_url %} + {% include "project/components/map/iframe_map.html" with src=map_url title="Explorateur des zonages d'urbanisme" %}
    \ No newline at end of file diff --git a/project/templates/project/components/map/iframe_map.html b/project/templates/project/components/map/iframe_map.html new file mode 100644 index 000000000..c54da6aeb --- /dev/null +++ b/project/templates/project/components/map/iframe_map.html @@ -0,0 +1,9 @@ + \ No newline at end of file From 8ca48a846d07a48bbbb564e190aa6bd20b24dba6 Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Mon, 25 Nov 2024 17:44:30 +0100 Subject: [PATCH 5/9] feat(maplibre): add pannel as maplibre control --- assets/scripts/map_libre/index.js | 19 ++++++++++++++++--- assets/scripts/map_libre/tabs.js | 12 ++++++++++++ carto/templates/carto/map_libre.html | 4 +++- .../dashboard/artificialisation.html | 9 ++------- .../components/dashboard/consommation.html | 9 ++------- .../project/components/map/iframe_map.html | 2 +- project/views/map.py | 7 +++++++ templates/index.html | 2 +- 8 files changed, 44 insertions(+), 20 deletions(-) diff --git a/assets/scripts/map_libre/index.js b/assets/scripts/map_libre/index.js index e37be8917..aa7efd885 100644 --- a/assets/scripts/map_libre/index.js +++ b/assets/scripts/map_libre/index.js @@ -17,6 +17,7 @@ export default class MapLibre this.mapCenter = _options.mapCenter this.defaultZoom = _options.defaultZoom this.data = _options.data + this.bounds = _options.bounds if (!this.targetElement) { @@ -87,6 +88,20 @@ export default class MapLibre // Set controls this.map.addControl(new maplibregl.NavigationControl(), 'top-left') + const fullScreenControl = new maplibregl.FullscreenControl() + this.map.addControl(fullScreenControl, 'bottom-right') + this.map.addControl(this.tabs, 'top-right') + this.map.scrollZoom.disable() + + fullScreenControl.on('fullscreenstart', () => this.map.scrollZoom.enable()) + fullScreenControl.on('fullscreenend', () => this.map.scrollZoom.disable()) + + if (this.bounds) + { + this.map.fitBounds(this.bounds, { + padding: 50, + }) + } }) } @@ -122,9 +137,7 @@ export default class MapLibre ) } - this.tabs = new Tabs({ - tabList, - }) + this.tabs = new Tabs({ tabList }) } setSources() diff --git a/assets/scripts/map_libre/tabs.js b/assets/scripts/map_libre/tabs.js index 6cf35ef06..e6e8948b2 100644 --- a/assets/scripts/map_libre/tabs.js +++ b/assets/scripts/map_libre/tabs.js @@ -16,6 +16,9 @@ export default class Tabs this.buttonsNode = document.createElement('div') this.buttonsNode.classList.add('tablist') + this.buttonsNode.style.pointerEvents = 'auto' + this.buttonsNode.style.height = '100vh' + this.buttonsNode.style.width = '50px' this.buttonsNode.setAttribute('role', 'tablist') this.buttonsNode.setAttribute('aria-label', 'Paramètres de la carte') @@ -46,6 +49,10 @@ export default class Tabs // Create tab const tabNode = document.createElement('div') + tabNode.style.width = '50vw' + tabNode.style.height = '100vh' + tabNode.style.right = '50px' + tabNode.style.pointerEvents = 'auto' tabNode.id = `${_tab.id}-tab` tabNode.classList.add('tab') tabNode.setAttribute('role', 'tabpanel') @@ -97,4 +104,9 @@ export default class Tabs { return this.tabsNode.querySelector(`[aria-labelledby="${_id}"]`) } + + onAdd() + { + return this.tabsNode + } } diff --git a/carto/templates/carto/map_libre.html b/carto/templates/carto/map_libre.html index 31620aa12..a01f24c47 100644 --- a/carto/templates/carto/map_libre.html +++ b/carto/templates/carto/map_libre.html @@ -47,13 +47,15 @@ {{ data|json_script:"data" }} {% endlocalize %} {% endblock bodyend %} diff --git a/project/templates/project/components/dashboard/artificialisation.html b/project/templates/project/components/dashboard/artificialisation.html index c641eb399..8a276f34e 100644 --- a/project/templates/project/components/dashboard/artificialisation.html +++ b/project/templates/project/components/dashboard/artificialisation.html @@ -158,13 +158,8 @@

    Evolution de l'artificialisation entre {{ first_millesime }} et {{ last_mill

    - + {% url 'project:theme-my-artif' project.pk as map_url %} + {% include "project/components/map/iframe_map.html" with src=map_url title="Carte comprendre l'artificialisation" %}
    diff --git a/project/templates/project/components/dashboard/consommation.html b/project/templates/project/components/dashboard/consommation.html index eab0fd62b..4f635b618 100644 --- a/project/templates/project/components/dashboard/consommation.html +++ b/project/templates/project/components/dashboard/consommation.html @@ -26,13 +26,8 @@

    Consommation d'espace annuelle sur le territoire

    {% if not is_commune %}
    - + {% url 'project:theme-city-conso' project.pk as map_url %} + {% include "project/components/map/iframe_map.html" with src=map_url title="ECarte consommation d'espaces des communes du territoire sur la période (en ha)" %}
    {% endif %} diff --git a/project/templates/project/components/map/iframe_map.html b/project/templates/project/components/map/iframe_map.html index c54da6aeb..63d0acc1b 100644 --- a/project/templates/project/components/map/iframe_map.html +++ b/project/templates/project/components/map/iframe_map.html @@ -6,4 +6,4 @@ loading="lazy" class="iframe-map" > - \ No newline at end of file + diff --git a/project/views/map.py b/project/views/map.py index 3176fbfbd..319ab86d3 100644 --- a/project/views/map.py +++ b/project/views/map.py @@ -30,6 +30,11 @@ class BaseMap(GroupMixin, DetailView): title = "To be set" default_zoom: int + @property + def bounds(self): + project: Project = self.get_object() + return list(project.land.mpoly.extent) + def get_context_breadcrumbs(self): breadcrumbs = super().get_context_breadcrumbs() breadcrumbs += [ @@ -339,6 +344,7 @@ def get_context_data(self, **kwargs): "center_lat": center.y, "center_lng": center.x, "default_zoom": self.default_zoom, + "bounds": self.bounds, "data": { "sources": self.get_sources_list(), "layers": layers, @@ -503,6 +509,7 @@ def get_gradient_expression(self): class UrbanZonesMapView(OcsgeCoverageMixin, BaseMap): breadcrumbs_title = title = "Explorateur des zonages d'urbanisme" default_zoom = 12 + bounds = None def get_sources_list(self): available_millesimes = self.object.get_available_millesimes(commit=True) diff --git a/templates/index.html b/templates/index.html index 46c60ab7c..dac953bb1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -44,7 +44,7 @@ {% endblock top_navigation %} -
    +
    {% if messages %}
    From 71815de6a4801838f1051760fa538fb1c9664805 Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Mon, 25 Nov 2024 18:11:14 +0100 Subject: [PATCH 6/9] feat(maplibre): disable crisp in iframe --- templates/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index dac953bb1..b057c1e6a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -33,7 +33,9 @@ {% adwords_google_tag_code %} - {% crisp_tag_code %} + {% if request.resolver_match.url_name not in 'home,home_rapport_local,map-urban-zones,theme-city-artif,theme-city-conso,theme-my-artif' %} + {% crisp_tag_code %} + {% endif %} From 7fcc419455a6d57a93d163a71faf3f44a157f75b Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Thu, 28 Nov 2024 14:47:04 +0100 Subject: [PATCH 7/9] fix(migration): merge --- project/migrations/0103_merge_20241128_1446.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 project/migrations/0103_merge_20241128_1446.py diff --git a/project/migrations/0103_merge_20241128_1446.py b/project/migrations/0103_merge_20241128_1446.py new file mode 100644 index 000000000..c443b3da5 --- /dev/null +++ b/project/migrations/0103_merge_20241128_1446.py @@ -0,0 +1,12 @@ +# Generated by Django 4.2.13 on 2024-11-28 13:46 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("project", "0102_alter_projectcommune_commune"), + ("project", "0102_remove_historicalproject_async_theme_map_gpu_done_and_more"), + ] + + operations = [] From a253e420b791809976178bf6cbdf93f13a4dc9dc Mon Sep 17 00:00:00 2001 From: "Alexis A." Date: Thu, 28 Nov 2024 14:48:43 +0100 Subject: [PATCH 8/9] feat(iframe_map): make height configurable --- project/templates/project/components/dashboard/gpu.html | 2 +- project/templates/project/components/map/iframe_map.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project/templates/project/components/dashboard/gpu.html b/project/templates/project/components/dashboard/gpu.html index 475a2fd66..3c5cea532 100644 --- a/project/templates/project/components/dashboard/gpu.html +++ b/project/templates/project/components/dashboard/gpu.html @@ -84,7 +84,7 @@

    Explorateur

    {% url 'project:map-urban-zones' project.pk as map_url %} - {% include "project/components/map/iframe_map.html" with src=map_url title="Explorateur des zonages d'urbanisme" %} + {% include "project/components/map/iframe_map.html" with src=map_url title="Explorateur des zonages d'urbanisme" height='75vh' %}
    \ No newline at end of file diff --git a/project/templates/project/components/map/iframe_map.html b/project/templates/project/components/map/iframe_map.html index 63d0acc1b..4d0c072c4 100644 --- a/project/templates/project/components/map/iframe_map.html +++ b/project/templates/project/components/map/iframe_map.html @@ -1,6 +1,6 @@