|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "# Set up for JupyterLite\n", |
| 10 | + "try:\n", |
| 11 | + " import piplite\n", |
| 12 | + " await piplite.install('ipyleaflet')\n", |
| 13 | + "except ImportError:\n", |
| 14 | + " pass" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "code", |
| 19 | + "execution_count": null, |
| 20 | + "metadata": {}, |
| 21 | + "outputs": [], |
| 22 | + "source": [ |
| 23 | + "from ipyleaflet import Map, basemaps, PMTilesLayer" |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + "cell_type": "code", |
| 28 | + "execution_count": null, |
| 29 | + "metadata": {}, |
| 30 | + "outputs": [], |
| 31 | + "source": [ |
| 32 | + "m = Map(center=[52.963529, 4.776306], zoom=7, basemap=basemaps.CartoDB.DarkMatter, scroll_wheel_zoom=True)\n", |
| 33 | + "m.layout.height = '600px'\n", |
| 34 | + "\n", |
| 35 | + "vl = PMTilesLayer(url=\"https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles\", \n", |
| 36 | + " style = {\n", |
| 37 | + " \"layers\": [\n", |
| 38 | + " {\n", |
| 39 | + " \"id\": \"admins\",\n", |
| 40 | + " \"source\": \"example_source\",\n", |
| 41 | + " \"source-layer\": \"admins\",\n", |
| 42 | + " \"type\": \"fill\",\n", |
| 43 | + " \"paint\": {\"fill-color\": \"#BDD3C7\", \"fill-opacity\": 0.1},\n", |
| 44 | + " },\n", |
| 45 | + " {\n", |
| 46 | + " \"id\": \"buildings\",\n", |
| 47 | + " \"source\": \"example_source\",\n", |
| 48 | + " \"source-layer\": \"buildings\",\n", |
| 49 | + " \"type\": \"fill\",\n", |
| 50 | + " \"paint\": {\"fill-color\": \"#FFFFB3\", \"fill-opacity\": 0.5},\n", |
| 51 | + " },\n", |
| 52 | + " {\n", |
| 53 | + " \"id\": \"places\",\n", |
| 54 | + " \"source\": \"example_source\",\n", |
| 55 | + " \"source-layer\": \"places\",\n", |
| 56 | + " \"type\": \"fill\",\n", |
| 57 | + " \"paint\": {\"fill-color\": \"#BEBADA\", \"fill-opacity\": 0.5},\n", |
| 58 | + " },\n", |
| 59 | + " {\n", |
| 60 | + " \"id\": \"roads\",\n", |
| 61 | + " \"source\": \"example_source\",\n", |
| 62 | + " \"source-layer\": \"roads\",\n", |
| 63 | + " \"type\": \"line\",\n", |
| 64 | + " \"paint\": {\"line-color\": \"#FB8072\"},\n", |
| 65 | + " },\n", |
| 66 | + " ],\n", |
| 67 | + " })\n", |
| 68 | + "m.add(vl)\n", |
| 69 | + "m" |
| 70 | + ] |
| 71 | + } |
| 72 | + ], |
| 73 | + "metadata": { |
| 74 | + "kernelspec": { |
| 75 | + "display_name": "Python 3 (ipykernel)", |
| 76 | + "language": "python", |
| 77 | + "name": "python3" |
| 78 | + }, |
| 79 | + "language_info": { |
| 80 | + "codemirror_mode": { |
| 81 | + "name": "ipython", |
| 82 | + "version": 3 |
| 83 | + }, |
| 84 | + "file_extension": ".py", |
| 85 | + "mimetype": "text/x-python", |
| 86 | + "name": "python", |
| 87 | + "nbconvert_exporter": "python", |
| 88 | + "pygments_lexer": "ipython3", |
| 89 | + "version": "3.10.5" |
| 90 | + } |
| 91 | + }, |
| 92 | + "nbformat": 4, |
| 93 | + "nbformat_minor": 4 |
| 94 | +} |
0 commit comments