{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook is based on the tutorial by [Andy Woodruff](https://twitter.com/awoodruff) at `https://github.com/awoodruff/leaflet-intro`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "using LeafletJS, GeoJSON" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "--2017-05-22 22:49:10-- https://raw.githubusercontent.com/awoodruff/leaflet-intro/gh-pages/neighborhoods.geojson\n", "Resolving raw.githubusercontent.com... 151.101.116.133\n", "Connecting to raw.githubusercontent.com|151.101.116.133|:443... connected.\n", "HTTP request sent, awaiting response... \n", " HTTP/1.1 200 OK\n", " Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'\n", " Strict-Transport-Security: max-age=31536000\n", " X-Content-Type-Options: nosniff\n", " X-Frame-Options: deny\n", " X-XSS-Protection: 1; mode=block\n", " ETag: \"25a0869041ee42bc7eb17f056f2dc6252aa5305f\"\n", " Content-Type: text/plain; charset=utf-8\n", " Cache-Control: max-age=300\n", " X-Geo-Block-List:\n", " X-GitHub-Request-Id: D94C:4AAA:1B776F0:1C953A9:5923A326\n", " Content-Length: 1450226\n", " Accept-Ranges: bytes\n", " Date: Tue, 23 May 2017 02:49:11 GMT\n", " Via: 1.1 varnish\n", " Connection: keep-alive\n", " X-Served-By: cache-bos8235-BOS\n", " X-Cache: MISS\n", " X-Cache-Hits: 0\n", " X-Timer: S1495507751.914336,VS0,VE124\n", " Vary: Authorization,Accept-Encoding\n", " Access-Control-Allow-Origin: *\n", " X-Fastly-Request-ID: 23252436f6e9af12dfdf2735ba2d9c6c8c07084f\n", " Expires: Tue, 23 May 2017 02:54:11 GMT\n", " Source-Age: 0\n", "Length: 1450226 (1.4M) [text/plain]\n", "Saving to: ‘neighborhoods.geojson’\n", "\n", " 0K .......... .......... .......... .......... .......... 3% 536K 3s\n", " 50K .......... .......... .......... .......... .......... 7% 2.73M 1s\n", " 100K .......... .......... .......... .......... .......... 10% 2.92M 1s\n", " 150K .......... .......... .......... .......... .......... 14% 4.31M 1s\n", " 200K .......... .......... .......... .......... .......... 17% 6.67M 1s\n", " 250K .......... .......... .......... .......... .......... 21% 3.92M 1s\n", " 300K .......... .......... .......... .......... .......... 24% 6.69M 1s\n", " 350K .......... .......... .......... .......... .......... 28% 3.64M 0s\n", " 400K .......... .......... .......... .......... .......... 31% 3.11M 0s\n", " 450K .......... .......... .......... .......... .......... 35% 6.49M 0s\n", " 500K .......... .......... .......... .......... .......... 38% 5.20M 0s\n", " 550K .......... .......... .......... .......... .......... 42% 6.88M 0s\n", " 600K .......... .......... .......... .......... .......... 45% 7.08M 0s\n", " 650K .......... .......... .......... .......... .......... 49% 7.92M 0s\n", " 700K .......... .......... .......... .......... .......... 52% 4.95M 0s\n", " 750K .......... .......... .......... .......... .......... 56% 7.50M 0s\n", " 800K .......... .......... .......... .......... .......... 60% 12.8M 0s\n", " 850K .......... .......... .......... .......... .......... 63% 4.13M 0s\n", " 900K .......... .......... .......... .......... .......... 67% 6.37M 0s\n", " 950K .......... .......... .......... .......... .......... 70% 6.08M 0s\n", " 1000K .......... .......... .......... .......... .......... 74% 8.13M 0s\n", " 1050K .......... .......... .......... .......... .......... 77% 7.63M 0s\n", " 1100K .......... .......... .......... .......... .......... 81% 6.93M 0s\n", " 1150K .......... .......... .......... .......... .......... 84% 5.92M 0s\n", " 1200K .......... .......... .......... .......... .......... 88% 8.67M 0s\n", " 1250K .......... .......... .......... .......... .......... 91% 7.25M 0s\n", " 1300K .......... .......... .......... .......... .......... 95% 9.97M 0s\n", " 1350K .......... .......... .......... .......... .......... 98% 7.41M 0s\n", " 1400K .......... ...... 100% 17.5M=0.3s\n", "\n", "Last-modified header missing -- time-stamps turned off.\n", "2017-05-22 22:49:11 (4.16 MB/s) - ‘neighborhoods.geojson’ saved [1450226/1450226]\n", "\n" ] } ], "source": [ ";wget https://raw.githubusercontent.com/awoodruff/leaflet-intro/gh-pages/neighborhoods.geojson" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "--2017-05-22 22:49:11-- https://raw.githubusercontent.com/awoodruff/leaflet-intro/gh-pages/rodents.geojson\n", "Resolving raw.githubusercontent.com... 151.101.116.133\n", "Connecting to raw.githubusercontent.com|151.101.116.133|:443... connected.\n", "HTTP request sent, awaiting response... \n", " HTTP/1.1 200 OK\n", " Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'\n", " Strict-Transport-Security: max-age=31536000\n", " X-Content-Type-Options: nosniff\n", " X-Frame-Options: deny\n", " X-XSS-Protection: 1; mode=block\n", " ETag: \"72c444f2994220c7fab2ac59715411e71187b0e6\"\n", " Content-Type: text/plain; charset=utf-8\n", " Cache-Control: max-age=300\n", " X-Geo-Block-List:\n", " X-GitHub-Request-Id: 2B1C:1FDD:13B87E6:1495E76:5923A326\n", " Content-Length: 407468\n", " Accept-Ranges: bytes\n", " Date: Tue, 23 May 2017 02:49:11 GMT\n", " Via: 1.1 varnish\n", " Connection: keep-alive\n", " X-Served-By: cache-bos8227-BOS\n", " X-Cache: MISS\n", " X-Cache-Hits: 0\n", " X-Timer: S1495507751.473299,VS0,VE99\n", " Vary: Authorization,Accept-Encoding\n", " Access-Control-Allow-Origin: *\n", " X-Fastly-Request-ID: 4f00f8e36307ceb1bedeffa541bc483eddab47b8\n", " Expires: Tue, 23 May 2017 02:54:11 GMT\n", " Source-Age: 0\n", "Length: 407468 (398K) [text/plain]\n", "Saving to: ‘rodents.geojson’\n", "\n", " 0K .......... .......... .......... .......... .......... 12% 535K 1s\n", " 50K .......... .......... .......... .......... .......... 25% 1.45M 0s\n", " 100K .......... .......... .......... .......... .......... 37% 2.46M 0s\n", " 150K .......... .......... .......... .......... .......... 50% 2.87M 0s\n", " 200K .......... .......... .......... .......... .......... 62% 3.79M 0s\n", " 250K .......... .......... .......... .......... .......... 75% 3.44M 0s\n", " 300K .......... .......... .......... .......... .......... 87% 3.58M 0s\n", " 350K .......... .......... .......... .......... ....... 100% 3.60M=0.2s\n", "\n", "Last-modified header missing -- time-stamps turned off.\n", "2017-05-22 22:49:11 (1.78 MB/s) - ‘rodents.geojson’ saved [407468/407468]\n", "\n" ] } ], "source": [ ";wget https://raw.githubusercontent.com/awoodruff/leaflet-intro/gh-pages/rodents.geojson" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "nbhd = GeoJSON.parsefile(\"neighborhoods.geojson\")\n", "rodents = GeoJSON.parsefile(\"rodents.geojson\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Stamen Tiles" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## stamen-toner (default)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## watercolor" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider = Provider.Stamen(:watercolor))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## terrain" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider = Provider.Stamen(:terrain))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## toposm-features" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider = Provider.Stamen(Symbol(\"toposm-features\")))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# OpenStreetMap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Mapnik (default)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.OSM())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Black and White" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.OSMBlackAndWhite())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Humanitarian OpenStreetMap Team (HOT)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.OSMHOT())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# CARTO" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## light_all (default)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.CARTO())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## dark_all" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.CARTO(:dark_all))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Hydda" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## full (default)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.Hydda())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Esri" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## World_Street_Map (default)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.Esri())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Specialty/DeLorme_World_Base_Map" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.Esri(Symbol(\"Specialty/DeLorme_World_Base_Map\")))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## World_Imagery" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.Esri(:World_Imagery))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## NatGeo_World_Map" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.Esri(:NatGeo_World_Map))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# NASA Global Imagery Browse Services (NASA GIBS)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## MODIS Terra: Corrected Reflectance (TrueColor)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.NASAGIBS())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Viirs Earth At Night 2012" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LeafletMap([nbhd, rodents], [42.35, -71.08], provider=Provider.NASAGIBS(:VIIRS_CityLights_2012))" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": true }, "outputs": [], "source": [ ";rm neighborhoods.geojson rodents.geojson" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 0.5.1", "language": "julia", "name": "julia-0.5" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "0.5.2" } }, "nbformat": 4, "nbformat_minor": 0 }