.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/other_applications/plot_delaunay_lines.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_other_applications_plot_delaunay_lines.py: .. _creating_delaunay_lines: Creating Delaunay Lines ======================= In this example, we show how to create AequilibraE's famous Delaunay Lines, but in Python. For more on this topic, see its `first publication `_. We use the Sioux Falls example once again. .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. seealso:: Several functions, methods, classes and modules are used in this example: * :func:`aequilibrae.utils.create_delaunay_network.DelaunayAnalysis` .. GENERATED FROM PYTHON SOURCE LINES 20-32 .. code-block:: Python # Imports import pandas as pd from uuid import uuid4 from os.path import join import sqlite3 from tempfile import gettempdir from geopandas import read_postgis from aequilibrae.utils.create_example import create_example from aequilibrae.utils.create_delaunay_network import DelaunayAnalysis .. GENERATED FROM PYTHON SOURCE LINES 33-39 .. code-block:: Python # We create an empty project on an arbitrary folder fldr = join(gettempdir(), uuid4().hex) project = create_example(fldr) .. GENERATED FROM PYTHON SOURCE LINES 40-41 Get the Delaunay Lines generation class .. GENERATED FROM PYTHON SOURCE LINES 41-46 .. code-block:: Python da = DelaunayAnalysis(project) # Let's create the triangulation based on the zones, but we could create based on the network (centroids) too da.create_network("zones") .. GENERATED FROM PYTHON SOURCE LINES 47-48 Now we get the matrix we want and create the Delaunay Lines .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python demand = project.matrices.get_matrix("demand_omx") demand.computational_view(["matrix"]) .. GENERATED FROM PYTHON SOURCE LINES 52-53 And we will call it 'delaunay_test'./ It will also be saved in the results_database.sqlite .. GENERATED FROM PYTHON SOURCE LINES 53-55 .. code-block:: Python da.assign_matrix(demand, "delaunay_test") .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/aequilibrae/aequilibrae/aequilibrae/paths/graph.py:218: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment. Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write). Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step. See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment build_compressed_graph(self, remove_dead_ends) delaunay : 0%| | 0/24 [00:00 .. GENERATED FROM PYTHON SOURCE LINES 77-78 Close the project .. GENERATED FROM PYTHON SOURCE LINES 78-79 .. code-block:: Python project.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.883 seconds) .. _sphx_glr_download__auto_examples_other_applications_plot_delaunay_lines.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_delaunay_lines.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_delaunay_lines.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_delaunay_lines.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_