Skip to main content

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

Code Coverage Gitlab CI PyPI

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

coordextract-0.1.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

coordextract-0.1.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file coordextract-0.1.2.tar.gz.

File metadata

  • Download URL: coordextract-0.1.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0

File hashes

Hashes for coordextract-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f4b27f56ca2b9734101647268f120d1c9a10d6e26a929f7bf2b5aee7f86e6f6
MD5 db9524127b4b1d0d6082f313be2579e6
BLAKE2b-256 5d559021d2df607acb604e1491e8f44839165cc502d7037042f1004a3f71ad9c

See more details on using hashes here.

File details

Details for the file coordextract-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: coordextract-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 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

Hashes for coordextract-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b2d8f91fd01d037cf59547226c10eff845bc3025d22910b3d91bfdfa072e2154
MD5 9561e91da1db92ffe5a91471b52f1f27
BLAKE2b-256 59c1f88dd34385b95cc3055698a1ee6fedd7e624936065b87ab3264965fcd195

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