geojson-length
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
$ pip install pytest$ poetry run pytest --color=yes --verbose --showlocals tests
You may need to run
poetry installfirst.
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)
| File | Size | Uploaded | |
|---|---|---|---|
| geojson-length-0.4.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geojson_length-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
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
|