diff --git a/README.md b/README.md deleted file mode 100644 index 623cfea..0000000 --- a/README.md +++ /dev/null @@ -1,107 +0,0 @@ - - - - -# Location Data Visualization library for Jupyter Notebooks - -[![Build Status](https://travis-ci.org/mapbox/mapboxgl-jupyter.svg?branch=master)](https://travis-ci.org/mapbox/mapboxgl-jupyter) -[![Coverage Status](https://coveralls.io/repos/github/mapbox/mapboxgl-jupyter/badge.svg?branch=master)](https://coveralls.io/github/mapbox/mapboxgl-jupyter?branch=master) -[![PyPI version](https://badge.fury.io/py/mapboxgl.svg)](https://badge.fury.io/py/mapboxgl) - -Create [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/) data visualizations natively in Jupyter Notebooks with Python and Pandas. `mapboxgl` is a high-performance, interactive, WebGL-based data visualization tool that drops directly into Jupyter. `mapboxgl` is similar to [Folium](https://github.com/python-visualization/folium) built on top of the raster [Leaflet](http://leafletjs.com/) map library, but with much higher performance for large data sets using WebGL and Mapbox Vector Tiles. - -![](https://cl.ly/3a0K2m1o2j1A/download/Image%202018-02-22%20at%207.16.58%20PM.png) - -Try out the interactive map example notebooks from the /examples directory in this repository - -1. [Categorical points](https://nbviewer.jupyter.org/github/mapbox/mapboxgl-jupyter/blob/master/examples/notebooks/point-viz-categorical-example.ipynb) -2. [All visualization types](https://nbviewer.jupyter.org/github/mapbox/mapboxgl-jupyter/blob/master/examples/notebooks/point-viz-types-example.ipynb) -3. [Choropleth Visualization types](https://nbviewer.jupyter.org/github/mapbox/mapboxgl-jupyter/blob/master/examples/notebooks/choropleth-viz-example.ipynb) -4. [Image Visualization types](https://nbviewer.jupyter.org/github/mapbox/mapboxgl-jupyter/blob/master/examples/notebooks/image-vis-type-example.ipynb) -5. [Raster Tile Visualization types](https://nbviewer.jupyter.org/github/mapbox/mapboxgl-jupyter/blob/master/examples/notebooks/rastertile-viz-type-example.ipynb) - -## Installation - -`pip install mapboxgl` - -# Documentation - -Checkout the documentation for [mapboxgl visuals](https://github.com/mapbox/mapboxgl-jupyter/blob/master/docs-markdown/viz.md) and [mapboxgl utilities](https://github.com/mapbox/mapboxgl-jupyter/blob/master/docs-markdown/utils.md). - -## Usage - -The `examples/` directory contains sample Jupyter notebooks demonstrating usage. - -```python -import pandas as pd -import os -from mapboxgl.utils import * -from mapboxgl.viz import * - -# Load data from sample csv -data_url = 'https://raw.githubusercontent.com/mapbox/mapboxgl-jupyter/master/examples/data/points.csv' -df = pd.read_csv(data_url) - -# Must be a public token, starting with `pk` -token = os.getenv('MAPBOX_ACCESS_TOKEN') - -# Create a geojson file export from a Pandas dataframe -df_to_geojson(df, filename='points.geojson', - properties=['Avg Medicare Payments', 'Avg Covered Charges', 'date'], - lat='lat', lon='lon', precision=3) - -# Generate data breaks and color stops from colorBrewer -color_breaks = [0,10,100,1000,10000] -color_stops = create_color_stops(color_breaks, colors='YlGnBu') - -# Create the viz from the dataframe -viz = CircleViz('points.geojson', - access_token=token, - height='400px', - color_property = "Avg Medicare Payments", - color_stops = color_stops, - center = (-95, 40), - zoom = 3, - below_layer = 'waterway-label' - ) -viz.show() -``` - -## Development - -Install the python library locally with pip: - -`pip install -e .` - -To run tests use pytest: - -`pip install mock` - -`pip install pytest` - -`pytest` - -To run the Jupyter examples, - -1. `cd examples` -2. `pip install jupyter` -2. `jupyter notebook` - -We follow the [PEP8 style guide for Python](http://www.python.org/dev/peps/pep-0008/) for all Python code. - -# Release process - -- After merging all relevant PRs for the upcoming release, pull the master branch - * `git checkout master` - * `git pull` -- Update the version number in `mapboxgl/__init__.py` and push directly to master. -- Tag the release - * `git tag ` - * `git push --tags` -- Setup for pypi (one time only) - * You'll need to `pip install twine` and set up your credentials in a [~/.pypirc](https://docs.python.org/2/distutils/packageindex.html#pypirc) [file](https://docs.python.org/2/distutils/packageindex.html#pypirc). -- Create the release files - * `rm dist/*` # clean out old releases if they exist - * `python setup.py sdist bdist_wheel` -- Upload the release files - * `twine upload dist/mapboxgl-*` diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..528440e --- /dev/null +++ b/README.rst @@ -0,0 +1,142 @@ +.. image:: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Mapbox_Logo.svg/1280px-Mapbox_Logo.svg.png + :width: 500 + :target: https://mapbox.com + +========================================================= +Location Data Visualization library for Jupyter Notebooks +========================================================= + +.. image:: https://travis-ci.org/mapbox/mapboxgl-jupyter.svg?branch=master + :target: https://travis-ci.org/mapbox/mapboxgl-jupyter + :alt: Build Status + +.. image:: https://coveralls.io/repos/github/mapbox/mapboxgl-jupyter/badge.svg?branch=master + :target: https://coveralls.io/github/mapbox/mapboxgl-jupyter?branch=master + :alt: Coverage Status + +.. image:: https://badge.fury.io/py/mapboxgl.svg + :target: https://badge.fury.io/py/mapboxgl + :alt: PyPI version + +Documentation at https://mapbox-mapboxgl-jupyter.readthedocs-hosted.com/en/latest/ + +Create `Mapbox GL JS `__ data +visualizations natively in Jupyter Notebooks with Python and Pandas. *mapboxgl* +is a high-performance, interactive, WebGL-based data visualization tool that +drops directly into Jupyter. *mapboxgl* is similar to `Folium +`__ built on top of the raster +`Leaflet `__ map library, but with much higher +performance for large data sets using WebGL and Mapbox Vector Tiles. + +.. image:: https://cl.ly/3a0K2m1o2j1A/download/Image%202018-02-22%20at%207.16.58%20PM.png + +Try out the interactive map example notebooks from the /examples directory in +this repository + +1. `Categorical points `__ +2. `All visualization types `__ +3. `Choropleth Visualization types `__ +4. `Image Visualization types `__ +5. `Raster Tile Visualization types `__ + +Installation +============ + +.. code-block:: bash + + $ pip install mapboxgl + +Documentation +============= + +Checkout the documentation for `mapboxgl visuals +`__ +and `mapboxgl utilities +`__. + +Usage +===== + +The ``examples`` directory contains sample Jupyter notebooks demonstrating usage. + +.. code-block:: python + + import os + + import pandas as pd + + from mapboxgl.utils import create_color_stops + from mapboxgl.viz import CircleViz + + + # Load data from sample csv + data_url = 'https://raw.githubusercontent.com/mapbox/mapboxgl-jupyter/master/examples/data/points.csv' + df = pd.read_csv(data_url) + + # Must be a public token, starting with `pk` + token = os.getenv('MAPBOX_ACCESS_TOKEN') + + # Create a geojson file export from a Pandas dataframe + df_to_geojson(df, filename='points.geojson', + properties=['Avg Medicare Payments', 'Avg Covered Charges', 'date'], + lat='lat', lon='lon', precision=3) + + # Generate data breaks and color stops from colorBrewer + color_breaks = [0,10,100,1000,10000] + color_stops = create_color_stops(color_breaks, colors='YlGnBu') + + # Create the viz from the dataframe + viz = CircleViz('points.geojson', + access_token=token, + height='400px', + color_property = "Avg Medicare Payments", + color_stops = color_stops, + center = (-95, 40), + zoom = 3, + below_layer = 'waterway-label' + ) + viz.show() + +Development +=========== + +Install the python library locally with pip: + +.. code-block:: console + + $ pip install -e . + +To run tests use pytest: + +.. code-block:: console + + $ pip install mock pytest + $ python -m pytest + +To run the Jupyter examples, + +.. code-block:: console + + $ cd examples + $ pip install jupyter + $ jupyter notebook + +We follow the `PEP8 style guide for Python `__ for all Python code. + +Release process +=============== + +- After merging all relevant PRs for the upcoming release, pull the master branch + * ``git checkout master`` + * ``git pull`` +- Update the version number in ``mapboxgl/__init__.py`` and push directly to master. +- Tag the release + * ``git tag `` + * ``git push --tags`` +- Setup for pypi (one time only) + * You'll need to ``pip install twine`` and set up your credentials in a [~/.pypirc](https://docs.python.org/2/distutils/packageindex.html#pypirc) [file](https://docs.python.org/2/distutils/packageindex.html#pypirc). +- Create the release files + * ``rm dist/*`` # clean out old releases if they exist + * ``python setup.py sdist bdist_wheel`` +- Upload the release files + * ``twine upload dist/mapboxgl-*`` diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..fa30e4b --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = mapbox-gl-js-jupyter +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/api/mapboxgl.rst b/docs/api/mapboxgl.rst new file mode 100644 index 0000000..48353b8 --- /dev/null +++ b/docs/api/mapboxgl.rst @@ -0,0 +1,54 @@ +mapboxgl package +================ + +Submodules +---------- + +mapboxgl.colors module +---------------------- + +.. automodule:: mapboxgl.colors + :members: + :undoc-members: + :show-inheritance: + +mapboxgl.errors module +---------------------- + +.. automodule:: mapboxgl.errors + :members: + :undoc-members: + :show-inheritance: + +mapboxgl.templates module +------------------------- + +.. automodule:: mapboxgl.templates + :members: + :undoc-members: + :show-inheritance: + +mapboxgl.utils module +--------------------- + +.. automodule:: mapboxgl.utils + :members: + :undoc-members: + :show-inheritance: + +mapboxgl.viz module +------------------- + +.. automodule:: mapboxgl.viz + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: mapboxgl + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/api/modules.rst b/docs/api/modules.rst new file mode 100644 index 0000000..b079862 --- /dev/null +++ b/docs/api/modules.rst @@ -0,0 +1,7 @@ +mapboxgl +======== + +.. toctree:: + :maxdepth: 4 + + mapboxgl diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..541ab76 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'mapboxgljs-jupyter' +copyright = '2018, Mapbox' +author = 'Mapbox' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +source_parsers = { + '.md': 'recommonmark.parser.CommonMarkParser', +} + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', +# 'numpydoc' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = ['.rst', '.md'] + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path . +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'mapbox-gl-js-jupyterdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'mapbox-gl-js-jupyter.tex', 'mapbox-gl-js-jupyter Documentation', + 'Mapbox', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'mapbox-gl-js-jupyter', 'mapbox-gl-js-jupyter Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'mapbox-gl-js-jupyter', 'mapbox-gl-js-jupyter Documentation', + author, 'mapbox-gl-js-jupyter', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..7dd6a10 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +.. mapbox-gl-js-jupyter documentation master file, created by + sphinx-quickstart on Fri May 4 11:31:00 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + + +.. include:: ../README.rst + +.. toctree:: + :maxdepth: 1 + :caption: Contents: + + utils.md + viz.md + api/mapboxgl.rst + api/modules.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs-markdown/utils.md b/docs/utils.md similarity index 100% rename from docs-markdown/utils.md rename to docs/utils.md diff --git a/docs-markdown/viz.md b/docs/viz.md similarity index 100% rename from docs-markdown/viz.md rename to docs/viz.md diff --git a/rtd-requirements.txt b/rtd-requirements.txt new file mode 100644 index 0000000..a2954e3 --- /dev/null +++ b/rtd-requirements.txt @@ -0,0 +1 @@ +numpydoc