Skip to main content

coordextract is a Python library and CLI tool for converting latitude and longitude data from GPX files into Military Grid Reference System (MGRS) coordinates. The library parses GPX files, extracts geographical points, and provides an efficient way to convert and export these points into various formats.

Project description

Code Coverage Gitlab CI

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

coordextract uses Poetry for dependency management. Poetry website

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.0.tar.gz (10.9 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.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coordextract-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 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.0.tar.gz
Algorithm Hash digest
SHA256 e8843dbf8df1076fa2ed0b5a5c1b74a5d69286db8b867f2908233438bfad2e68
MD5 b5e27c960360e5edb34d5b0149c7323d
BLAKE2b-256 c635dbbbc8fbc3ca64e10852368b1f82a2307fc4d815325ee7bb070e795e8b57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coordextract-0.1.0-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

Hashes for coordextract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 655637b309b799002a4a73f75419fb2c910119d50dce869a07145a3bb9786bcd
MD5 fee90949a45cc9be194e6cb53ea708d5
BLAKE2b-256 e4f0a9a340934b9190f3f6390b0574fe2476eefd1c7176771aa593d3c6117950

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