Skip to content

Instantly share code, notes, and snippets.

@jqtrde
Created January 25, 2018 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jqtrde/daef70d6aab17d3e32b21ae96a7dcd73 to your computer and use it in GitHub Desktop.
Save jqtrde/daef70d6aab17d3e32b21ae96a7dcd73 to your computer and use it in GitHub Desktop.
A nice little geojson renderer for Jupyter Lab.
$ pip install jupyterlab
$ jupyter labextension install @jupyterlab/geojson-extension
from IPython.display import GeoJSON
import json
import os
URL_TEMPLATE = "https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=TOKEN".replace('TOKEN', os.environ.get('MapboxAccessToken'))
with open("wichita.geojson") as geoj:
data = json.load(geoj)
GeoJSON(
data=data,
url_template=URL_TEMPLATE,
layer_options={
"id": "mapbox.satellite"
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment