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.3.tar.gz (11.5 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.3-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coordextract-0.1.3.tar.gz
  • Upload date:
  • Size: 11.5 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.3.tar.gz
Algorithm Hash digest
SHA256 ff0eedfb2538cc5e20aa3c6a97f114b7c100aa350330c80a9e676b9f26593753
MD5 54b738576eea04116c7f66aec77aa2cd
BLAKE2b-256 676f5c3f9966e423bf0a1b91b9e3fd396b3fe5acb79f684ce989b3e9fff6e37e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coordextract-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 302ececdb7aa1975654572c560d6f258e605fa92f086e535f4c7d5d8d712fde9
MD5 27a22698e39ca76cc1ad747f43af6589
BLAKE2b-256 3570e31308313c8c8827fe11d877df2d1c329f1e587125ffbea460d7012e666b

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