geojsonio.py
Open GeoJSON data on geojson.io from Python. geojsonio.py also contains a command line utility that is a Python port of geojsonio-cli.
Usage
Send data to geojson.io and open a browser within python
from geojsonio import display
with open('map.geojson') as f:
contents = f.read()
display(contents)
Data
There are two methods by which geojsonio.py gets geojson.io to render the data:
Embedding the GeoJSON contents in the geojson.io URL directly
Creating an anonymous Github gist and embedding the gist id in the geojson.io URL.
geojsonio.py 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 geojsonio.py 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
geojsonio.py 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')]
geojsonio.display(m_states.to_json())
This will open a browser to the geojson.io window with the polygons drawn on the slippy map.
IPython Notebook Integration
To easily embed geojson.io in an iframe in a Jupyter/IPython notebook, use the embed() method
embed(contents)
Command Line Interface
It can also be used on the command line. Read or pipe a file
$ geojsonio map.geojson $ geojsonio < run.geojson
Options:
--print prints the url rather than opening it --domain="http://custominstancedomain.com/"
Installation
Install with pip
$ pip install geojsonio
Metadata
Release files for geojsonio 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geojsonio-0.0.3.tar.gz | 4.7 kB | Without provenance | Details for geojsonio-0.0.3.tar.gz |
Release files / geojsonio-0.0.3.tar.gz
| Download URL | geojsonio-0.0.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2afe91d9a86e30aaf0c449f430a024ab03503db3efce2e26ff5f1057f32f1083
|
|
BLAKE2b-256 checksum How to use checksums |
7f42a773a4d4a6a78261dce418269cd017d8ff401206bc5724d9390084ebbf3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for geojsonio 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.