Create Mapbox GL JS data visualizations natively in your Jupyter Notebook workflows with Python, GeoJSON and Pandas dataframes. Mapboxgl aims to be a data visualization focused mapping library built on top of the Mapbox GL JS SDK, similar to Folium built on top of Leaflet.
Currently supported map visualization types:
- Circles
- Graduated Circles
- Heatmaps
pip install mapboxgl
Install the python library locally with pip:
pip install -e .
To run tests use pytest:
pytest
To run the jupiter examples,
cd examples
pip install jupyter
jupyter notebook
mapboxgl
visualizations take GeoJSON data as input.
You can convert pandas
dataframes to a GeoJSON feature collection:
data = df_to_geojson(df, ['Avg Total Payments'],
lat='latitude', lon='longitude')
Using the CircleViz
visualization to view the data with
a color ramp for the total payment column. Within a Jupyter
notebook:
viz = CircleViz(data,
color_property='Avg Total Payments',
color_stops=color_stops,
access_token=YOUR_PUBLIC_ACCESS_TOKEN)
viz.show()
The examples/
directory contains Jupyter notebooks
demonstrating more advanced usage.
Under heavy development. As we move towards a 1.0 release, expect
API changes. If you're interested in contributing and are
curious about the direction of the project, check out ROADMAP.md
.
- Install Python3.4+
pip install mapboxgl
- cd to /example directory of mapboxgl-jupyter repo
- Open the
test-python.ipynb
workbook - Put your Mapbox GL Access Token (it's free for developers!) into the notebook, cell 4.
- Run all cells in the notebook and enjoy the interactive maps.