|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "%matplotlib inline\n", |
| 10 | + "\n", |
| 11 | + "import contextily as ctx\n", |
| 12 | + "import geopandas as gpd\n", |
| 13 | + "import pandas as pd\n", |
| 14 | + "import matplotlib.pyplot as plt" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "code", |
| 19 | + "execution_count": null, |
| 20 | + "metadata": {}, |
| 21 | + "outputs": [], |
| 22 | + "source": [ |
| 23 | + "provider = ctx.providers[\"PDOK\"]['opentopo_EPSG_28992']\n", |
| 24 | + "provider" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "code", |
| 29 | + "execution_count": null, |
| 30 | + "metadata": {}, |
| 31 | + "outputs": [], |
| 32 | + "source": [ |
| 33 | + "w = 128_000.0\n", |
| 34 | + "s = 440_000.0\n", |
| 35 | + "e = 150_000.0\n", |
| 36 | + "n = 460_000.0\n", |
| 37 | + "a, extent = ctx.bounds2img_wmts(w, s, e, n, url=provider, zoom=\"auto\")\n", |
| 38 | + "fig, ax = plt.subplots(figsize=(10, 10))\n", |
| 39 | + "ax.imshow(a, interpolation=\"spline36\")" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": null, |
| 45 | + "metadata": {}, |
| 46 | + "outputs": [], |
| 47 | + "source": [ |
| 48 | + "x = 155_000.0\n", |
| 49 | + "y = 463_000.0\n", |
| 50 | + "df = pd.DataFrame({\"Locatie\": [\"Onze Lieve Vrouwentoren\"], \"x\": [x], \"y\": [y]})\n", |
| 51 | + "gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.x, df.y))\n", |
| 52 | + "ax = gdf.plot(figsize=(10, 10))\n", |
| 53 | + "a = ctx.add_basemap_wmts(ax, provider, interpolation=\"spline36\", zoom=\"auto\", reset_extent=False)" |
| 54 | + ] |
| 55 | + } |
| 56 | + ], |
| 57 | + "metadata": { |
| 58 | + "kernelspec": { |
| 59 | + "display_name": "Python 3.7.6 64-bit ('salty': conda)", |
| 60 | + "language": "python", |
| 61 | + "name": "python37664bitsaltycondaf755b71eb5284478984b9eadde8a8258" |
| 62 | + }, |
| 63 | + "language_info": { |
| 64 | + "codemirror_mode": { |
| 65 | + "name": "ipython", |
| 66 | + "version": 3 |
| 67 | + }, |
| 68 | + "file_extension": ".py", |
| 69 | + "mimetype": "text/x-python", |
| 70 | + "name": "python", |
| 71 | + "nbconvert_exporter": "python", |
| 72 | + "pygments_lexer": "ipython3", |
| 73 | + "version": "3.7.6" |
| 74 | + } |
| 75 | + }, |
| 76 | + "nbformat": 4, |
| 77 | + "nbformat_minor": 4 |
| 78 | +} |
0 commit comments