.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_delimitationOfBuildingAreas.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_delimitationOfBuildingAreas.py: Délimitation de tâches bâties ---------------------------------------------------------------- Dans ce notebook, nous allons délimiter des zones bâties pour la ville de Caen. .. GENERATED FROM PYTHON SOURCE LINES 6-13 .. code-block:: default # sphinx_gallery_thumbnail_number = 3 import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import geopandas as gpd .. GENERATED FROM PYTHON SOURCE LINES 14-18 Lecture des données ================================ On ouvre le fond du bâti de la ville de Caen. .. GENERATED FROM PYTHON SOURCE LINES 18-21 .. code-block:: default bati = gpd.read_file(os.getenv("URL_BATI_VILLE")) .. GENERATED FROM PYTHON SOURCE LINES 22-26 Délimitation des zones bâties ================================ On calcule un buffer de 100 mètres autour de chaque bâtiment. .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: default bati_buffer_positif=bati.copy() bati_buffer_positif['geometry']=bati_buffer_positif.geometry.buffer(100) .. GENERATED FROM PYTHON SOURCE LINES 31-32 On fusionne les buffers avec une intersection non nulle et on affiche les zones fusionnées. .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: default union_buffer=gpd.GeoDataFrame({'geometry':bati_buffer_positif.unary_union}) ax = union_buffer.plot() .. image:: /gallery/images/sphx_glr_plot_delimitationOfBuildingAreas_001.png :alt: plot delimitationOfBuildingAreas :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 37-38 On effectue un buffer négatif pour affiner la délimitation afin de compenser le buffer positif prélablement réaliser pour capter les relations de bâtiments voisins. L'affichage de la carte montre des zones plus délimitées. .. GENERATED FROM PYTHON SOURCE LINES 38-43 .. code-block:: default union_buffer_negatif=union_buffer.copy() union_buffer_negatif['geometry']=union_buffer_negatif.buffer(-100) ax = union_buffer_negatif['geometry'].plot() .. image:: /gallery/images/sphx_glr_plot_delimitationOfBuildingAreas_002.png :alt: plot delimitationOfBuildingAreas :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 44-45 On décide d'afficher que les zones de plus de 8 hectares. .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: default union_buffer_negatif['aire']=union_buffer_negatif['geometry'].area/10000 ax = union_buffer_negatif[union_buffer_negatif.aire>8].plot() .. image:: /gallery/images/sphx_glr_plot_delimitationOfBuildingAreas_003.png :alt: plot delimitationOfBuildingAreas :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 15.710 seconds) .. _sphx_glr_download_gallery_plot_delimitationOfBuildingAreas.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_delimitationOfBuildingAreas.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_delimitationOfBuildingAreas.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_