Skip to main content

Calculate the length of a GeoJSON LineString or MultiLineString

Project description

geojson-length

https://img.shields.io/pypi/v/geojson-length.svg https://img.shields.io/travis/zaitra/geojson-length.svg

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
      ]
    ]
  }
}

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.

History

0.1.0 (2020-06-04)

  • First release on PyPI.

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-length-0.1.2.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

geojson_length-0.1.2-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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