topojson - a powerful library to encode geographic data as topology in Python!🌍
Project description
topojson
Encode geographic data as topology in Python!
Topojson is a library that is capable of creating a topojson encoded format of merely any geographical object in Python.
With topojson it is possible to reduce the size of your geographical data. Mostly by orders of magnitude. It is able to do so through:
- Eliminating redundancy through computation of a topology
- Fixed-precision integer encoding of coordinates and
- Simplification and quantization of arcs
Usage
The package can be used in multiple different ways, with the main purpose to create a TopoJSON topology.
See the Python Topojson Documentation Site for all info or this Notebook with some examples, such as the following:
Top row (right) presents linestring simplification on a computed Topology and (left) on the geographical object directly. Bottom row presents visual impact on file size reduction between (left) Raw GeoJSON and (right) Topological optimized TopoJSON.
Installation
Installation can be done by:
python3 -m pip install topojson
This package topojson has the following hard dependencies:
numpyshapely
Further, optional soft dependencies are:
altair(enlarge the experience by visualizing your TopoJSON output)simplification(more and quicker simplification options)geojson(parse string input with GeoJSON data)geopandas(withfionaversion >=1.8.6!, parse your TopoJSON output directly into a GeoDataFrame)ipywidgets+ (lab)extension (make your life complete with the interactive experience)
Get in touch
For now, just use the Github issues. That can be:
- usage questions
- bug reports
- feature suggestions
- or anything related
Finally, see the Python Topojson Documentation Site for more info.
Changelog
Version 1.0:
- fix duplicate coordinates in geojson export #112
- add docs how-it-works
- replace dispatcher with if-else statments #114
Version 1.0rc11:
- support for
fionaCollections, using the optionalgeojsonmodule #100 - improvements on popping of merged linestrings #105, #107
- the
to_gdf()funtion is serialized through GeoJSON features and not through Fiona/OGR #108 - documentation updates #101 and #103
Version 1.0rc10:
- introduced
shared_coordsas new default strategy to detect junctions #76 (thanks @martinfleis!) - optimize reading geopandas objects #77
- add
prevent_oversimplifyas parameter #86 - fix
serialize_as_json()to dump correct json to file #87 (thanks @olenhb!) - store linestrings internally as numpy arrays instead of shapely geometries #90 - #97
- generate a speedup of ~20X for larger geographical objects
Version 1.0rc9:
- include
to_geojson()function to return the Topology as an GeoJSON object #71 - include a
__geo_interface__for theTopology()class #71
Version 1.0rc8:
- complex shared paths are registered correctly #63
- new insterted junctions are inserted in right order #64
Version 1.0rc7:
- major refactoring to include quantization of points
- and to hash combinations of polygons/linestrings with points #61
Version 1.0rc6:
- fix linemerging of non-duplicate arcs #50
- include
__geo_interface__attributed as input #53 - include travis testing on GitHub (thanks @Casyfill!)
- migrate from unittests to pytest (thanks @Casyfill!)
Version 1.0rc5:
- change
TopoOptionsinto_dictto be serializable #46 - changed all
inttonp.int64, since it is platform specific #49, #45
Version 1.0rc4:
- no
linestringkey in topojson - serialize
strof TopoJSON or GeoJSON data - add
vwas algoritm type and update widget
Version 1.0rc3:
- changed class object to inherit sequence
- removed the
topojson.topologyfunction - introducted the
topojson.Topologyclass - speedups and bug fixes, see #15 - #36
- introduced multiple options see #8
Version 1.0rc2:
- apply linemerge on non-duplicate arcs
- fix computing topology without shared boundaries #1, #3
- use
geopandasandgeojsonsolely for tests, but recognize them as type #2, #4 - use
simplificationas option to simplify linestrings - include option to snap vertices to grid
- removed
rdtreeas dependency, useSRTtreefromshapelyinstead
Version 1.0rc1:
- initial release
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topojson-1.0.tar.gz.
File metadata
- Download URL: topojson-1.0.tar.gz
- Upload date:
- Size: 23.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e370259e872bd45535f1495fae6c041c3693d82e6f1db8983aaa3d51ca6b15b7
|
|
| MD5 |
170cf4b58e0c5c7592c811fe4f9c83ad
|
|
| BLAKE2b-256 |
0162ac5aa25b5bddde0f139f287d6e81903f5b8463cde1b1703bdf0a549bfcff
|
File details
Details for the file topojson-1.0-py2.py3-none-any.whl.
File metadata
- Download URL: topojson-1.0-py2.py3-none-any.whl
- Upload date:
- Size: 78.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e83aeae7f1ece18c96f62f01619f94443c333b4257048b4abbd61d8ebe1fe96
|
|
| MD5 |
6e749f797b2f07fc1f2db44f5fdc726a
|
|
| BLAKE2b-256 |
98479a7c95170e0ce89404ce8f76140af8c821e17d0f7fd55c53394ccd3a1ba2
|