From 68e2b66021cafea8e4195f904c03a3851b69a8a3 Mon Sep 17 00:00:00 2001 From: Christoph Rieke Date: Tue, 23 Apr 2024 21:32:19 +0200 Subject: [PATCH] example notebook --- .gitignore | 2 + prettymapp/example_notebook.ipynb | 74 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 prettymapp/example_notebook.ipynb diff --git a/.gitignore b/.gitignore index 85c71ae..08b5b67 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,8 @@ dmypy.json # Pyre type checker .pyre/ +<_io.BytesIO* +.vscode/* .idea/ cache/ prettybasicmaps/cache diff --git a/prettymapp/example_notebook.ipynb b/prettymapp/example_notebook.ipynb new file mode 100644 index 0000000..8b70917 --- /dev/null +++ b/prettymapp/example_notebook.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "770d1893-70b9-4c65-8651-903346f355a9", + "metadata": {}, + "outputs": [], + "source": [ + "from prettymapp.geo import get_aoi\n", + "from prettymapp.osm import get_osm_geometries\n", + "from prettymapp.plotting import Plot\n", + "from prettymapp.settings import STYLES\n", + "\n", + "aoi = get_aoi(address=\"Praça Ferreira do Amaral, Macau\", radius=1100, rectangular=False)\n", + "df = get_osm_geometries(aoi=aoi)\n", + "\n", + "fig = Plot(\n", + " df=df,\n", + " aoi_bounds=aoi.bounds,\n", + " draw_settings=STYLES[\"Peach\"]\n", + ").plot_all()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1321e1fb-82d9-4d15-a4a3-696422063ecc", + "metadata": {}, + "outputs": [], + "source": [ + "from prettymapp.osm import get_osm_geometries_from_xml\n", + "\n", + "df = get_osm_geometries_from_xml(filepath=\"./tests/mock_data/osm_xml_file.osm\")\n", + "aoi_bounds = df.total_bounds\n", + "\n", + "fig = Plot(\n", + " df=df,\n", + " aoi_bounds=aoi_bounds,\n", + " draw_settings=STYLES[\"Peach\"]\n", + ").plot_all()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "787f0a25-0eb4-45de-8889-2db572c09c26", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "prettymapp", + "language": "python", + "name": "prettymapp" + }, + "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 +}