Skip to main content

Stats for GeoJSON data

Project description

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 git+https://github.com/emi420/geojson-stats

Latest on PyPi: 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

python geojson_stats/cli.py -f example/tkm_waterways.geojson --keys waterway --value-keys waterway --length --verbose
{
  "count": 4447,
  "length": 23318.876036089594,
  "key": {
    "waterway": {
      "count": 4447,
      "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
        }
      }
    },
    "source": {
      "count": 173
    },
    "osm_id": {
      "count": 4447
    },
    "osm_type": {
      "count": 4447
    },
    "layer": {
      "count": 821
    },
    "tunnel": {
      "count": 883
    },
    "name": {
      "count": 535
    },
    "name:en": {
      "count": 223
    },
    "name:tk": {
      "count": 99
    },
    "width": {
      "count": 94
    }
  }
}

License

GNU Affero General Public License

(c) Emilio Mariscal 2024

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geojson_stats-0.1.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geojson_stats-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file geojson_stats-0.1.0.tar.gz.

File metadata

  • Download URL: geojson_stats-0.1.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for geojson_stats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74a408addf1aaca9a82f46e009ea2c4dd57c502806e8161c650f0dc2c4576380
MD5 12862c9f3150b7ae3a1d5ab91bbfa483
BLAKE2b-256 5d16c4ca14ffe8b7049377e32fd36324e0f56198f816f01fd22f7430a4f7d9e9

See more details on using hashes here.

File details

Details for the file geojson_stats-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: geojson_stats-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for geojson_stats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5461ce306d61de402dabcff87b3ef0c29d3acabb779aa1c34636905ea0a27ba
MD5 d7a92e7e78fb5a179f1d5236d9df2ca2
BLAKE2b-256 b0f27df44b109ff208cb64c9810238e89460e214f207674585c3009371741024

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page