geojsonio CLI - Python.
Project description
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)
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file geojsonio-0.0.2.tar.gz
.
File metadata
- Download URL: geojsonio-0.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c118a4c954df47c7b481458c4752c1abfcaf9803bb6340b3526b00f821a50f09 |
|
MD5 | e75b0ec0786d456dc630f93874106bfd |
|
BLAKE2b-256 | 4545cf3f4a656134729786010ef01174b5c91556d765acb16662d103856dd91f |