Name | geojson-stats JSON |
Version |
0.2.4
JSON |
| download |
home_page | None |
Summary | Stats for GeoJSON data |
upload_time | 2024-11-20 12:55:10 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | AGPL-3.0-only |
keywords |
hot
geojson
data
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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:
```bash
pip install geojson-stats
```
### Usage
```bash
geojsonstats -f <GEOJSON FILE>
```
Help and options:
```bash
geojsonstats -h
```
#### Python
```py
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](https://data.humdata.org/dataset/hotosm_tkm_waterways)
```bash
geojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --verbose
```
```json
{
"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:
```bash
geojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --html example/waterway_stats_tpl.html > stats.htm
```
<img width="906" alt="Screenshot 2024-11-14 at 00 01 26" src="https://github.com/user-attachments/assets/b50a1c26-0126-4f57-8516-7d02343d6a6e">
## License
GNU Affero General Public License
(c) Emilio Mariscal 2024
Raw data
{
"_id": null,
"home_page": null,
"name": "geojson-stats",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "hot, geojson, data",
"author": null,
"author_email": "Emilio Mariscal <emilio.mariscal@hotosm.org>",
"download_url": "https://files.pythonhosted.org/packages/31/71/c3ac5eb5063cb834f2033b668ebc6091e966b25d1c03491c4fb91497ffb7/geojson_stats-0.2.4.tar.gz",
"platform": null,
"description": "# geojson-stats\n\nStats for GeoJSON data \n\n(total / per property / per value)\n\n- Features count\n- Length for lines \n- Area for polygons\n\n## Quick start\n\n### Install\n\nDirectly from the main branch:\n\n```bash\npip install geojson-stats\n```\n\n### Usage\n\n```bash\ngeojsonstats -f <GEOJSON FILE>\n```\n\nHelp and options:\n\n```bash\ngeojsonstats -h\n```\n\n#### Python\n\n```py\nfrom geojson_stats.stats import Stats, Config\n\nconfig = Config(\n clean = True,\n length = True,\n keys=[\"waterway\"],\n value_keys=[\"waterway\"]\n)\n\nstats = Stats(config)\nstats.process_file(\"example/tkm_waterways.geojson\")\n\nprint(\"Count:\", stats.results.count)\nstats.dump()\n```\n\n### Example\n\nGetting stats from Turkmenistan Waterways (OpenStreetMap Export)\ndownloaded from [HDX](https://data.humdata.org/dataset/hotosm_tkm_waterways)\n\n```bash\ngeojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --verbose\n```\n\n```json\n{\n \"count\": 4447,\n \"length\": 23318.876036089594,\n \"languages\": {\n \"list\": [\n \"name\",\n \"name:en\",\n \"name:tk\"\n ],\n \"count\": 3\n },\n \"key\": {\n \"waterway\": {\n \"count\": 4447,\n \"percent\": 100.0,\n \"length\": 23318.876036089594,\n \"value\": {\n \"canal\": {\n \"count\": 2164,\n \"length\": 11890.79586499543\n },\n \"drain\": {\n \"count\": 370,\n \"length\": 636.8213551633588\n },\n \"river\": {\n \"count\": 435,\n \"length\": 8353.148822879351\n },\n \"ditch\": {\n \"count\": 1125,\n \"length\": 1251.067586054797\n },\n \"wadi\": {\n \"count\": 26,\n \"length\": 133.95910280981897\n },\n \"stream\": {\n \"count\": 281,\n \"length\": 982.3192418240153\n },\n \"dam\": {\n \"count\": 42,\n \"length\": 68.91994831893784\n },\n \"weir\": {\n \"count\": 2,\n \"length\": 0.03208190453249057\n },\n \"derelict_canal\": {\n \"count\": 2,\n \"length\": 1.812032139385983\n }\n }\n },\n \"osm_id\": {\n \"count\": 4447,\n \"percent\": 100.0\n },\n \"osm_type\": {\n \"count\": 4447,\n \"percent\": 100.0\n },\n \"tunnel\": {\n \"count\": 883,\n \"percent\": 19.86\n },\n \"layer\": {\n \"count\": 821,\n \"percent\": 18.46\n },\n \"name\": {\n \"count\": 535,\n \"percent\": 12.03\n },\n \"name:en\": {\n \"count\": 223,\n \"percent\": 5.01\n },\n \"source\": {\n \"count\": 173,\n \"percent\": 3.89\n },\n \"name:tk\": {\n \"count\": 99,\n \"percent\": 2.23\n },\n \"width\": {\n \"count\": 94,\n \"percent\": 2.11\n }\n }\n}\n```\n\n### HTML\n\nYou can also generate stats in HTML format, using a template.\n\nFor example:\n\n```bash\ngeojsonstats -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --html example/waterway_stats_tpl.html > stats.htm\n```\n<img width=\"906\" alt=\"Screenshot 2024-11-14 at 00 01 26\" src=\"https://github.com/user-attachments/assets/b50a1c26-0126-4f57-8516-7d02343d6a6e\">\n\n## License\n\nGNU Affero General Public License\n\n(c) Emilio Mariscal 2024\n",
"bugtrack_url": null,
"license": "AGPL-3.0-only",
"summary": "Stats for GeoJSON data",
"version": "0.2.4",
"project_urls": {
"documentation": "https://github.com/emi420/geojson-stats",
"homepage": "https://github.com/emi420/geojson-stats",
"repository": "https://github.com/emi420/geojson-stats"
},
"split_keywords": [
"hot",
" geojson",
" data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "193d80f1f94ed0081416ef68ad371eb0fc7e95abd2a1e25708ff2b7b837051c2",
"md5": "03add8cd7ecf1c5cd0c909985b3889df",
"sha256": "f416a499f3cde665a64ddac81a9da6cfacaa3c4f19e1060e29f40ea2b33fded3"
},
"downloads": -1,
"filename": "geojson_stats-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "03add8cd7ecf1c5cd0c909985b3889df",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 20519,
"upload_time": "2024-11-20T12:55:09",
"upload_time_iso_8601": "2024-11-20T12:55:09.022170Z",
"url": "https://files.pythonhosted.org/packages/19/3d/80f1f94ed0081416ef68ad371eb0fc7e95abd2a1e25708ff2b7b837051c2/geojson_stats-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3171c3ac5eb5063cb834f2033b668ebc6091e966b25d1c03491c4fb91497ffb7",
"md5": "6078b657e4c75a263191526edbe67971",
"sha256": "97373b17fbaa70483e76492b8c95d19592d3216dff4c4710f803b22b1589561a"
},
"downloads": -1,
"filename": "geojson_stats-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "6078b657e4c75a263191526edbe67971",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20082,
"upload_time": "2024-11-20T12:55:10",
"upload_time_iso_8601": "2024-11-20T12:55:10.823707Z",
"url": "https://files.pythonhosted.org/packages/31/71/c3ac5eb5063cb834f2033b668ebc6091e966b25d1c03491c4fb91497ffb7/geojson_stats-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 12:55:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "emi420",
"github_project": "geojson-stats",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "geojson-stats"
}