All Projects → pbugnion → Gmaps

pbugnion / Gmaps

Licence: other
Google maps for Jupyter notebooks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Gmaps

Dual-color-Polyline-Animation
This library will help to show the polyline in dual color similar as Uber.
Stars: ✭ 73 (-89.65%)
Mutual labels:  maps, google-maps
SimplePlacePicker
Android place picker module for searching and selecting a location on google maps
Stars: ✭ 42 (-94.04%)
Mutual labels:  maps, google-maps
mapus
A map tool with real-time collaboration 🗺️
Stars: ✭ 2,687 (+281.13%)
Mutual labels:  maps, google-maps
activeadmin-latlng
Active Admin plugin for setting up latitude and longitude
Stars: ✭ 34 (-95.18%)
Mutual labels:  maps, google-maps
polylineencoder
A C++ implementation of Google Encoded Polyline Algorithm Format (encoder/decoder)
Stars: ✭ 15 (-97.87%)
Mutual labels:  maps, google-maps
map-kit-android
An extensive framework for map development in Android.
Stars: ✭ 44 (-93.76%)
Mutual labels:  maps, google-maps
carto-react
CARTO for React packages
Stars: ✭ 17 (-97.59%)
Mutual labels:  maps, google-maps
ember-google-maps
A friendly Ember addon for working with Google Maps.
Stars: ✭ 93 (-86.81%)
Mutual labels:  maps, google-maps
EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (-79.86%)
Mutual labels:  maps, google-maps
google-maps-at-88-mph
Google Maps keeps old satellite imagery around for a while – this tool collects what's available for a user-specified region in the form of a GIF.
Stars: ✭ 93 (-86.81%)
Mutual labels:  maps, google-maps
trackanimation
Track Animation is a Python 2 and 3 library that provides an easy and user-adjustable way of creating visualizations from GPS data.
Stars: ✭ 74 (-89.5%)
Mutual labels:  maps, google-maps
Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (-13.19%)
Mutual labels:  google-maps, maps
js-markerclusterer
Create and manage clusters for large amounts of markers
Stars: ✭ 92 (-86.95%)
Mutual labels:  maps, google-maps
HealthCare-Scan-Nearby-Hospital-Locations
I developed this android application to help beginner developers to know how to use Google Maps API and how to convert JSON data into Java Object.
Stars: ✭ 23 (-96.74%)
Mutual labels:  maps, google-maps
GoogleMapsHelper
An easy to integrate Model Based Google Maps Helper (SVHTTPClient, AFNetworking) That lets you Geo Code , Reverse Geocode, Get Directions , Places Autocomplete.
Stars: ✭ 21 (-97.02%)
Mutual labels:  maps, google-maps
google-streetview-images
Pull google streetview panoramic images along a route.
Stars: ✭ 45 (-93.62%)
Mutual labels:  maps, google-maps
google maps
🗺 An unofficial Google Maps Platform client library for the Rust programming language.
Stars: ✭ 40 (-94.33%)
Mutual labels:  maps, google-maps
svelte-googlemaps
Svelte Google Maps Components
Stars: ✭ 62 (-91.21%)
Mutual labels:  maps, google-maps
carto-react-template
CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
Stars: ✭ 24 (-96.6%)
Mutual labels:  maps, google-maps
Jquery Store Locator Plugin
A store locator plugin using Google Maps API version 3
Stars: ✭ 471 (-33.19%)
Mutual labels:  google-maps, maps

|travis| |pypi| |docs|

gmaps

gmaps is a plugin for including interactive Google maps in the IPython Notebook.

Let's plot a heatmap <http://jupyter-gmaps.readthedocs.io/en/latest/tutorial.html#heatmaps>_ of taxi pickups in San Francisco:

.. code:: python

import gmaps
import gmaps.datasets
gmaps.configure(api_key="AI...") # Your Google API key

# load a Numpy array of (latitude, longitude) pairs
locations = gmaps.datasets.load_dataset("taxi_rides")

fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations))
fig

.. image:: docs/source/_images/taxi_example.png

We can also plot chloropleth maps using GeoJSON <http://jupyter-gmaps.readthedocs.io/en/latest/tutorial.html#geojson-layer>_:

.. code:: python

from matplotlib.cm import viridis
from matplotlib.colors import to_hex

import gmaps
import gmaps.datasets
import gmaps.geojson_geometries

gmaps.configure(api_key="AI...") # Your Google API key

countries_geojson = gmaps.geojson_geometries.load_geometry('countries') # Load GeoJSON of countries

rows = gmaps.datasets.load_dataset('gini') # 'rows' is a list of tuples
country2gini = dict(rows) # dictionary mapping 'country' -> gini coefficient
min_gini = min(country2gini.values())
max_gini = max(country2gini.values())
gini_range = max_gini - min_gini

def calculate_color(gini):
    """
    Convert the GINI coefficient to a color
    """
    # make gini a number between 0 and 1
    normalized_gini = (gini - min_gini) / gini_range

    # invert gini so that high inequality gives dark color
    inverse_gini = 1.0 - normalized_gini

    # transform the gini coefficient to a matplotlib color
    mpl_color = viridis(inverse_gini)

    # transform from a matplotlib color to a valid CSS color
    gmaps_color = to_hex(mpl_color, keep_alpha=False)

    return gmaps_color

# Calculate a color for each GeoJSON feature
colors = []
for feature in countries_geojson['features']:
    country_name = feature['properties']['name']
    try:
        gini = country2gini[country_name]
        color = calculate_color(gini)
    except KeyError:
        # no GINI for that country: return default color
        color = (0, 0, 0, 0.3)
    colors.append(color)

fig = gmaps.figure()
gini_layer = gmaps.geojson_layer(
    countries_geojson,
    fill_color=colors,
    stroke_color=colors,
    fill_opacity=0.8)
fig.add_layer(gini_layer)
fig

.. image:: docs/source/_images/geojson-2.png

Or, for coffee fans, a map of all Starbucks in the UK:

.. code:: python

import gmaps
import gmaps.datasets
gmaps.configure(api_key="AI...") # Your Google API key

df = gmaps.datasets.load_dataset_as_df('starbucks_kfc_uk')

starbucks_df = df[df['chain_name'] == 'starbucks']
starbucks_df = starbucks_df[['latitude', 'longitude']]

starbucks_layer = gmaps.symbol_layer(
starbucks_df, fill_color="green", stroke_color="green", scale=2
)
fig = gmaps.figure()
fig.add_layer(starbucks_layer)
fig

.. image:: docs/source/_images/starbucks-symbols.png

Installation

Installing jupyter-gmaps with conda ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The easiest way to install gmaps is with conda::

$ conda install -c conda-forge gmaps

Installing jupyter-gmaps with pip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Make sure that you have enabled ipywidgets widgets extensions::

$ jupyter nbextension enable --py --sys-prefix widgetsnbextension

You can then install gmaps with::

$ pip install gmaps

Then tell Jupyter to load the extension with::

$ jupyter nbextension enable --py --sys-prefix gmaps

Installing jupyter-gmaps for JupyterLab ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To use jupyter-gmaps with JupyterLab, you will need to install the jupyter widgets extension for JupyterLab::

$ jupyter labextension install @jupyter-widgets/jupyterlab-manager

You can then install jupyter-gmaps via pip (or conda)::

$ pip install gmaps

Next time you open JupyterLab, you will be prompted to rebuild JupyterLab: this is necessary to include the jupyter-gmaps frontend code into your JupyterLab installation. You can also trigger this directly on the command line with::

$ jupyter lab build

Support for JupyterLab pre 1.0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To install jupyter-gmaps with versions of JupyterLab pre 1.0, you will need to pin the version of jupyterlab-manager and of jupyter-gmaps. Find the version of the jupyterlab-manager that you need from this compatibility table <https://github.com/jupyter-widgets/ipywidgets/tree/master/packages/jupyterlab-manager>_. For instance, for JupyterLab 0.35.x::

$ jupyter labextension install @jupyter-widgets/[email protected]

Then, install a pinned version of jupyter-gmaps::

$ pip install gmaps==0.8.4

You will then need to rebuild JupyterLab with::

$ jupyter lab build

Google API keys

To access Google maps, gmaps needs a Google API key. This key tells Google who you are, presumably so it can keep track of rate limits and such things. To create an API key, follow the instructions in the documentation <http://jupyter-gmaps.readthedocs.io/en/latest/authentication.html>_. Once you have an API key, pass it to gmaps before creating widgets:

.. code:: python

gmaps.configure(api_key="AI...")

Documentation

Documentation for gmaps is available here <http://jupyter-gmaps.readthedocs.io/en/latest/>_.

Similar libraries

The current version of this library is inspired by the ipyleaflet <https://github.com/ellisonbg/ipyleaflet>_ notebook widget extension. This extension aims to provide much of the same functionality as gmaps, but for leaflet maps, not Google maps.

Vision and roadmap

Jupyter-gmaps is built for data scientists. Data scientists should be able to visualize geographical data on a map with minimal friction. Beyond just visualization, they should be able to integrate gmaps into their widgets so they can build interactive applications.

We see the priorities of gmaps as:

  • responding to events, like user clicks, so that maps can be used interactively.
  • adding greater flexibility and customisability (e.g. choosing map styles)

Issue reporting and contributing

Report issues using the github issue tracker <https://github.com/pbugnion/gmaps/issues>_.

Contributions are welcome. Read the CONTRIBUTING guide to learn how to contribute.

.. |travis| image:: https://travis-ci.org/pbugnion/gmaps.svg?branch=master :target: https://travis-ci.org/pbugnion/gmaps :alt: Travis build status

.. |pypi| image:: https://img.shields.io/pypi/v/gmaps.svg?style=flat-square&label=version :target: https://pypi.python.org/pypi/gmaps :alt: Latest version released on PyPi

.. |docs| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat :target: http://jupyter-gmaps.readthedocs.io/en/latest/ :alt: Latest documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].