coordextract is a Python library and CLI tool for converting data from GPX files into pydantic models and adding MGRS coordinates to the data. The CLI will return the data in JSON format.
Project description
coordextract
coordextract is a Python library and CLI tool for converting data from GPX files into pydantic models for further processesing. It was designed to be used as a FastAPI service.
While building the pydantic model it verifies that the points are legitimate and does MGRS conversion which is added to the model as a new field.
The CLI tool will output the model as a JSON string or file.
Features
- Batch process GPX files asynchronously with asyncio.
- Use CPU concurrency if datasets are large.
- Command-line interface (CLI).
Installation
poetry add coordextract
or
pip install coordextract
coordextract uses Poetry for dependency management. Poetry website
To install the development version of coordextract, clone the repository and install the dependencies with Poetry.
git clone https://github.com/SMcLeaish/coordextract/
cd coordextract
poetry install
As a library
The main entry point for the library is the CoordExtract.process_coords()
from coordextract import process_coords
"""
process_coords() takes five arguments:
- input_file(s): Path - The path to the input GPX file(s).
- output_file: Optional(Path) - The path to the output file.
- indent: Optional(int) - The number of spaces to indent JSON output.
Default 2.
- concurrency: Optional(bool) - Will attempt to spawn multiple processes
for batch requests. Default False.
- context: Optional(str) - If None a the PointModel will be returned.
If set to cli, output will be JSON to stdout if no output file is
specified. Default None.
"""
process_coords('path/to/file.gpx', 'path/to/output.csv', 2, True, 'cli')
As a CLI tool
coordextract on the command line takes gpx file(s) as its first input and supports the following options:
--output-file - The path to the output file.
--indent - The number of spaces to indent JSON output. Default 2.
--concurrency - Will attempt to spawn multiple processes for batch requests.
--help - Display the help message.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This repository is mirrored at https://github.com/SMcLeaish/coordextract/ from https://gitlab.com/smcleaish/coordextract and uses gitlab CI
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coordextract-0.1.1.tar.gz.
File metadata
- Download URL: coordextract-0.1.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20fb3ec72f8617f01b7ab6a62d0caf689a972cf45b797df6de4da7d7f40f800f
|
|
| MD5 |
1462a915681fdb0dac9e112efa090b33
|
|
| BLAKE2b-256 |
442c14eec4c6fb93413c4cfc6f41edbcc02a9fd79fa5e1e51884a59c8644e329
|
File details
Details for the file coordextract-0.1.1-py3-none-any.whl.
File metadata
- Download URL: coordextract-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a16ef3614c036d21a18d95b66bfb235b62ee4061ad81bf55b8a35a875001a27
|
|
| MD5 |
4c9f3e16230f029b8a1d0ee9327c605e
|
|
| BLAKE2b-256 |
212bbe02c84ddc81236a808ed33f387c7d1944971f603ce444069e2352bfd6ef
|