diff --git a/mwe.ipynb b/mwe.ipynb new file mode 100644 index 0000000..4a3cd87 --- /dev/null +++ b/mwe.ipynb @@ -0,0 +1,147 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "3848ed8f-b092-49e1-a66e-8de9a39e6ae9", + "metadata": {}, + "source": [ + "![title](superblockify_logo.png)" + ] + }, + { + "cell_type": "markdown", + "id": "74a6085d-50ec-4334-a0e5-13ed2b776b5b", + "metadata": {}, + "source": [ + "# Minimum working example" + ] + }, + { + "cell_type": "markdown", + "id": "6ddf99e9-c41c-4a47-878e-4f04d480fa2e", + "metadata": {}, + "source": [ + "This notebook runs a minimum working example with `superblockify`. \n", + "The learn more about `superblockify`, visit: [superblockify.city](https://superblockify.city)" + ] + }, + { + "cell_type": "markdown", + "id": "5fa10ad7-f17b-4cd0-b02d-375beacf5efa", + "metadata": {}, + "source": [ + "## Import `superblockify`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dfa871e2-7683-428c-a4a6-df97cb62fdec", + "metadata": {}, + "outputs": [], + "source": [ + "import superblockify as sb" + ] + }, + { + "cell_type": "markdown", + "id": "92a6ae87-0b1c-4960-a1b7-9c4f6b4ff673", + "metadata": {}, + "source": [ + "## Initialize the partitioner" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daa39c85-bc2e-4f83-810e-d9957b4fa87c", + "metadata": {}, + "outputs": [], + "source": [ + "partitioner = sb.ResidentialPartitioner(\n", + " name=\"Scheveningen_test\",\n", + " city_name=\"Scheveningen\",\n", + " search_str=\"Scheveningen, NL\",\n", + " unit=\"time\", # \"time\", \"distance\", any other edge attribute, or None to count edges\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "ba2b9fa5-172e-4dab-949e-3151e6c2c360", + "metadata": {}, + "source": [ + "Select a different city by finding the corresponding search string (`search_str`) at [https://nominatim.openstreetmap.org/](https://nominatim.openstreetmap.org/ui/search.html?q=Scheveningen%2C+NL). \n", + "The smaller the place, the quicker the partitioning. For large places sufficient memory is required." + ] + }, + { + "cell_type": "markdown", + "id": "d9580056-4c90-4b3e-b362-0cb361578eb5", + "metadata": {}, + "source": [ + "## Run the partitioner" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "56c03f44-8603-47b4-9436-e36c7bdf649c", + "metadata": {}, + "outputs": [], + "source": [ + "partitioner.run(\n", + " calculate_metrics=True, # set to False if you are not interested in metrics\n", + " make_plots=True, # set to False if you are not interested in plots\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "6aaa66e4-12aa-45cb-8307-1c756c02987c", + "metadata": {}, + "source": [ + "## Save results" + ] + }, + { + "cell_type": "markdown", + "id": "3932594e-5aa8-4c59-9691-a8b07841cd18", + "metadata": {}, + "source": [ + "Save the results to a GeoPackage (`.gpkg`) file:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c04e0a0c-fb4d-4068-bfec-7d881546962c", + "metadata": {}, + "outputs": [], + "source": [ + "sb.save_to_gpkg(partitioner, save_path=None)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "sb_env", + "language": "python", + "name": "sb_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}