Skip to main content

MGRS coordinate conversion for Python

Project description

mgrs: Converting to and from MGRS and Decimal Degrees

GeoTrans provides C code for converting to and from MGRS, but well, it’s C code :). This is a simple ctypes wrapper around two of the MGRS-related functions in GeoTrans.

This library has an internal copy of some of the files from GeoTrans 2.4.2.

travisstatus

ChangeLog

1.4.2

  • GitHub Action builders needed to be changed to push release

1.4.1

  • Fix install requirements #34

1.4.0

  • Alias and deprecate RTreeError #33

1.3.9

  • MGRS now requires packaging library #31

  • Fix wheel imports of shared libs

1.3.8

  • UTF-8 encoding for all strings.

  • Fix #29 implicit tuple on return of UTMToMGRS

1.3.7

  • automated building of osx, linux and win64 wheels

  • Migrate from TravisCI => GitHub Actions

  • Warnings cleanup

  • flake8 validation

1.3.6

1.3.4

1.3.3

1.3.2

  • Better Windows support

  • Bug fix for 3 digit longitudes

1.3.1

  • Python 3.x support

  • Allow user to override precision in UTMToMGRS

Usage

In a nutshell:

>>> import mgrs

>>> latitude = 42.0
>>> longitude = -93.0

>>> m = mgrs.MGRS()
>>> c = m.toMGRS(latitude, longitude)
>>> c
'15TWG0000049776'

>>> d = m.toLatLon(c)
>>> d
(41.999997975127997, -93.000000000000014)

>>> y = '321942.29N'
>>> yd = m.dmstodd(y)
32.328414

>>> d, m, s = m.ddtodms(32.328414)
>>> d, m, s
(32.0, 19.0, 42.290400)

You can also control the precision of the MGRS grid with the MGRSPrecision arguments in .toMGRS(). Other than that, there isn’t too much to it.

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

mgrs-1.4.2.tar.gz (31.5 kB view details)

Uploaded Source

Built Distributions

mgrs-1.4.2-cp38-cp38-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (47.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl (21.8 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

mgrs-1.4.2-cp37-cp37m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (47.6 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

mgrs-1.4.2-cp37-cp37m-macosx_10_14_x86_64.whl (21.8 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

mgrs-1.4.2-cp36-cp36m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (47.6 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.5+ x86-64

mgrs-1.4.2-cp36-cp36m-macosx_10_14_x86_64.whl (21.8 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

Details for the file mgrs-1.4.2.tar.gz.

File metadata

  • Download URL: mgrs-1.4.2.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2.tar.gz
Algorithm Hash digest
SHA256 12dd1c994d1e3e0ce17e62eeab01243c6f1e6de6a4423dc9d1bcbd84b7448948
MD5 b6022e966e5df322a476f3e018afda66
BLAKE2b-256 f3367114872ab5aa64b73b8cae1b300152b7ad5f6fa785c9becfbca530534737

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 534d018f77ebb04fc57573959910ed21d2791f485a49f5da03bc25d48061fd56
MD5 6e3f15095733045a0dd2e45ff647c99e
BLAKE2b-256 d97002b3172b4014e0eeac64efc6b486376ae18fcce4065406e75d965d5f2a9d

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: CPython 3.8, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0f9d2eb2280014d448fb1f551457d3d42c43c8d77dd9f77bf763a28443627833
MD5 8bd5ca3ad0df3ab8f82b0c28263b4518
BLAKE2b-256 d5fcc397102df2f672c7b4711c1ff73815b9ddd5317eaa28557579b9cfaa84ee

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a681a5d50d446359e4064811a58bbaf4449ff14937837b01a789d2538e720e83
MD5 fcedc510c7f12fa1a5f0b9bf1b917940
BLAKE2b-256 66ba78ddda197bfcdcef65fa17a9ae5648dba0247cb5d3c4a1e649a2bcf1026c

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8dd7512fc41d8a21935ab994c0a64865023a64630b4cd04693c3ab4214383881
MD5 c3eb9ec67d5be3e05b2e4a96e5fe2cd6
BLAKE2b-256 4fc919a9d24a598a0786419c124f5cafa50ab58014da56b8eca9fb67b41e8689

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6f93b404069791d5e1e146a9cff64cc8f44d942bb98a7046077ae546866ba52f
MD5 e651d7ee6d68b7ceb714f1eda296d14c
BLAKE2b-256 02e74b049e052fc604291c083029b51cfcb3c7225e7dacb91ee9dc85ece43383

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 aa10a6146d5320dc6c9d5ea7275607d27d4d2abe39e3faf693038c67f123a266
MD5 f1fe430d9ca4a18f895e1bee1e9ce26f
BLAKE2b-256 d911078e79819cdc4a2656a9c27ce5c38fbfb9a122428fac3110da1e5b2078d5

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5309258228c00fefae456a9913b39524ed2e6e4e72179c75f94cae4daef14835
MD5 ee9eb4ba8245c2cf3f6f5b725b760a2b
BLAKE2b-256 e701d9a3e191f5bcce6616f1a1d462c5b4acecd497250065706689abbef50363

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 780e592df4af715ab6938b301acd108a587f255469c9535536012e41a2845c3b
MD5 73ff8e78db194ef488579f3fb44d8cc9
BLAKE2b-256 3a644e14b225b04485271499c9c2ac96fa6f8e7f2884690ba7c85db531081445

See more details on using hashes here.

File details

Details for the file mgrs-1.4.2-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mgrs-1.4.2-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for mgrs-1.4.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3b13faa885922f3de3c48c776a409eac0d542072b6c77dad6f4b43b37c382d89
MD5 41124b31820b915fac3448ae72ce008d
BLAKE2b-256 ba38d942d535f8a4d00d428853140ed3aaeab23e368fd56fea514d2c93599345

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page