Skip to main content

geojson-length

Build Pypi

Calculate the length of a GeoJSON LineString or MultiLineString

Installation


$ pip3 install geojson-length

Usage


  >>> from geojson_length import calculate_distance, Unit
  >>> from geojson import Feature, LineString

  >>> line = Feature(geometry=LineString([[19.6929931640625,48.953170117120976],[19.5556640625,48.99283383694351]]))
  >>> calculate_distance(line, Unit.meters)
  10979.098283583924

Note: You need to install python-geojson first or you can define GeoJSON as python dict:

    line = {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            19.6929931640625,
            48.953170117120976
          ],
          [
            19.5556640625,
            48.99283383694351
          ]
        ]
      }
    }

Run test suite

  1. $ pip install pytest
  2. $ poetry run pytest --color=yes --verbose --showlocals tests

You may need to run poetry install first.

Credits


This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage` project template.

The idea was inspired by geojson-length package written in JS.

License

Free software: MIT license

Metadata

Release files for geojson-length 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geojson-length 0.4.0
File Size Uploaded Provenance Actions
geojson-length-0.4.0.tar.gz 3.7 kB Without provenance Details for geojson-length-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geojson-length 0.4.0
File Interpreter ABI Platform Actions
geojson_length-0.4.0-py3-none-any.whl Python 3 none any Details for geojson_length-0.4.0-py3-none-any.whl

Total release size: 7.9 kB

Release files / geojson-length-0.4.0.tar.gz

Download URL geojson-length-0.4.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5840132e20e68aae5cd0f34b8cb55354603fb914560105b3ff851d0965079a54
BLAKE2b-256 checksum
How to use checksums
fda6308d1b54f4a508e6d069f6f6bd922c122b91b11e4f5017a6f0cc1b739c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.12 Linux/5.11.0-1028-azure

Release files / geojson_length-0.4.0-py3-none-any.whl

Download URL geojson_length-0.4.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b92bb06cd9f64fd3128473f675c9e11fb262957ebe867973d742960833d3d965
BLAKE2b-256 checksum
How to use checksums
8163405661443e61cf485a9a1314998d13cc4e3c07dcbfd434cf85d79abe1614
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.12 Linux/5.11.0-1028-azure

Security for geojson-length 0.4.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page