geojson-stats
Stats for GeoJSON data
(total / per property / per value)
- Features count
- Length for lines
- Area for polygons
Quick start
Install
Directly from the main branch:
pip install geojson-stats
Usage
geojsonstats -f <GEOJSON FILE>
Help and options:
geojsonstats -h
Python
from geojson_stats.stats import Stats, Config
config = Config(
clean = True,
length = True,
keys=["waterway"],
value_keys=["waterway"]
)
stats = Stats(config)
stats.process_file("example/tkm_waterways.geojson")
print("Count:", stats.results.count)
stats.dump()
Example
Getting stats from Turkmenistan Waterways (OpenStreetMap Export) downloaded from HDX
geojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --verbose
{
"count": 4447,
"length": 23318.876036089594,
"languages": {
"list": [
"name",
"name:en",
"name:tk"
],
"count": 3
},
"key": {
"waterway": {
"count": 4447,
"percent": 100.0,
"length": 23318.876036089594,
"value": {
"canal": {
"count": 2164,
"length": 11890.79586499543
},
"drain": {
"count": 370,
"length": 636.8213551633588
},
"river": {
"count": 435,
"length": 8353.148822879351
},
"ditch": {
"count": 1125,
"length": 1251.067586054797
},
"wadi": {
"count": 26,
"length": 133.95910280981897
},
"stream": {
"count": 281,
"length": 982.3192418240153
},
"dam": {
"count": 42,
"length": 68.91994831893784
},
"weir": {
"count": 2,
"length": 0.03208190453249057
},
"derelict_canal": {
"count": 2,
"length": 1.812032139385983
}
}
},
"osm_id": {
"count": 4447,
"percent": 100.0
},
"osm_type": {
"count": 4447,
"percent": 100.0
},
"tunnel": {
"count": 883,
"percent": 19.86
},
"layer": {
"count": 821,
"percent": 18.46
},
"name": {
"count": 535,
"percent": 12.03
},
"name:en": {
"count": 223,
"percent": 5.01
},
"source": {
"count": 173,
"percent": 3.89
},
"name:tk": {
"count": 99,
"percent": 2.23
},
"width": {
"count": 94,
"percent": 2.11
}
}
}
HTML
You can also generate stats in HTML format, using a template.
For example:
geojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --html example/waterway_stats_tpl.html > stats.htm
License
GNU Affero General Public License
(c) Emilio Mariscal 2024
Metadata
Release files for geojson-stats 0.2.9
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 | |
|---|---|---|---|---|
| geojson_stats-0.2.9.tar.gz | 20.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geojson_stats-0.2.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.0 kB
Release files / geojson_stats-0.2.9.tar.gz
| Download URL | geojson_stats-0.2.9.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d14b19f0d76eb4a4c9fe2923e16c6bcd4e85f2ee800c4f94da2acfacbf80980a
|
|
BLAKE2b-256 checksum How to use checksums |
26a7d90e25f1d46d6f22de967bad94d5907d739f24aca510d3ca88b9b988fc77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / geojson_stats-0.2.9-py3-none-any.whl
| Download URL | geojson_stats-0.2.9-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
144b4b4de17b401a02f5d4a82af330875b383048ebde47aace7ce3930bbbd288
|
|
BLAKE2b-256 checksum How to use checksums |
123e14fc0fe94a6dc1ae9bb69756a782241d077bed923427aef3bd8418cab046
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for geojson-stats 0.2.9
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.