Open GeoJSON data on from Python. also contains a command line utility that is a Python port of geojsonio-cli.


Send data to and open a browser within python

from geojsonio import display

with open('map.geojson') as f:
    contents =


There are two methods by which gets to render the data:

  • Embedding the GeoJSON contents in the URL directly
  • Creating an anonymous Github gist and embedding the gist id in the URL. automatically determines which method is used based on the length of the GeoJSON contents. If the contents are small enough, they will be embedded in the URL. Otherwise creates an anonymous Gist on Github with the GeoJSON contents. Note: when an anonymous gist is created, the data is uploaded to Github and a unique gist ID is created. If anyone else is able to obtain the gist ID, they will be able to see your data.

Goes Great With GeoPandas integrates nicely with GeoPandas to display data in a GeoDataFrame.

Say you have a file containing the borders of all states called states.geojson. Each GeoJSON record has a property called 'Name'. Quickly display all the states whose names start with 'M'

import geopandas as gpd
import geojsonio

states = gpd.read_file('states.geojson')
m_states = states[states['Name'].str.startswith('M')]

This will open a browser to the window with the polygons drawn on the slippy map.

IPython Notebook Integration

To easily embed in an iframe in a Jupyter/IPython notebook, use the embed() method


Command Line Interface

It can also be used on the command line. Read or pipe a file

$ geojsonio map.geojson
$ geojsonio < run.geojson


--print prints the url rather than opening it


Install with pip

$ pip install geojsonio