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:
numpy
shapely
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
(withfiona
version >=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
fiona
Collections, using the optionalgeojson
module #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_coords
as new default strategy to detect junctions #76 (thanks @martinfleis!) - optimize reading geopandas objects #77
- add
prevent_oversimplify
as 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
TopoOptions
into_dict
to be serializable #46 - changed all
int
tonp.int64
, since it is platform specific #49, #45
Version 1.0rc4
:
- no
linestring
key in topojson - serialize
str
of TopoJSON or GeoJSON data - add
vw
as algoritm type and update widget
Version 1.0rc3
:
- changed class object to inherit sequence
- removed the
topojson.topology
function - introducted the
topojson.Topology
class - 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
geopandas
andgeojson
solely for tests, but recognize them as type #2, #4 - use
simplification
as option to simplify linestrings - include option to snap vertices to grid
- removed
rdtree
as dependency, useSRTtree
fromshapely
instead
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
Hashes for topojson-1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e83aeae7f1ece18c96f62f01619f94443c333b4257048b4abbd61d8ebe1fe96 |
|
MD5 | 6e749f797b2f07fc1f2db44f5fdc726a |
|
BLAKE2b-256 | 98479a7c95170e0ce89404ce8f76140af8c821e17d0f7fd55c53394ccd3a1ba2 |