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.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.3.8.tar.gz (32.4 kB view details)

Uploaded Source

Built Distributions

mgrs-1.3.8-cp38-cp38-win_amd64.whl (22.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

mgrs-1.3.8-cp38-cp38-manylinux1_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.8

mgrs-1.3.8-cp38-cp38-macosx_10_14_x86_64.whl (21.3 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

mgrs-1.3.8-cp37-cp37m-win_amd64.whl (22.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

mgrs-1.3.8-cp37-cp37m-manylinux1_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.7m

mgrs-1.3.8-cp37-cp37m-macosx_10_14_x86_64.whl (21.3 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

mgrs-1.3.8-cp36-cp36m-win_amd64.whl (22.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

mgrs-1.3.8-cp36-cp36m-manylinux1_x86_64.whl (47.0 kB view details)

Uploaded CPython 3.6m

mgrs-1.3.8-cp36-cp36m-macosx_10_14_x86_64.whl (21.3 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: mgrs-1.3.8.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8.tar.gz
Algorithm Hash digest
SHA256 5ba69009201cb0f3b333fbd098dcf565f5b9d1d04fc5ef9a2c97fd206b7eebac
MD5 7f8784881ca40ec38b457656a22dd5cc
BLAKE2b-256 7be80bfe081e4cf62886b5e1f7afff5602511c6b7e839fc8cdd515dd911904c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f13e87df0c7fddfd21634ae7134e483373536776dce29396ff9a42fab6c2df2a
MD5 64cadce0898fbad189b7296f7a65758e
BLAKE2b-256 9bc00f2e930a9dcfdfbabfb75a4ca134104cfbaaf2ae7aa401dfd020a7344179

See more details on using hashes here.

File details

Details for the file mgrs-1.3.8-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.3.8-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 448f5ede320abd2b7c7b68127c02ad31b2c0da73c8d0e03223e0eadad89b648d
MD5 9cf381de59c25673f88106a78ff8e8e9
BLAKE2b-256 c7af370c620fbafc4722676f1eb68de3b7dd15204a98b8e49127e4089a7080b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6480cb03a9671d4eeb74f45bd100ccc2375b9cc5d59898b102ff172a24a2c03c
MD5 2fd064192d4c4b68ca554ac39926a0f2
BLAKE2b-256 1a66c49f0f3e9afded3dc50f408fa477813807991b72ccd8881f9da59d227389

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2ef0a92bb03a58900a2925840cf0de47c977ecfc45d16fe41dab5d05b8ee5811
MD5 4e6e88731d074fbafb81965bcb850c0a
BLAKE2b-256 e93cac05398c6182cf06482cbc3e1f2f92a97556484d888b33874ee0f129c94a

See more details on using hashes here.

File details

Details for the file mgrs-1.3.8-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.3.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b642af6bd7d8f783fb1fc4841c155782911ef3566d99b8eac5b2a0e185076424
MD5 e68009cb65e0d42a3e901b6c5fabb606
BLAKE2b-256 762019c89bb147fda7ef6649fc79578612da10f222c20751d2cf8cca1ff61d9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2addec7a1f896284a5b9f16e4e5cf83d17ad6aab21cbdf06b413f70935e0cd06
MD5 5416a1c9782f8dc6452553e5d3f95a84
BLAKE2b-256 0fb7fef1590050b7aaec506428c4509da09fbb6f115d04c80007c97a4433d58c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 eef37c8cab08cd770659fb9b8374237d4711e9c0e0d33430c13d3ca46d203863
MD5 7950637fad0d577a11b971720f249ef6
BLAKE2b-256 c946a7f8c40907b714b821f82435a91e8de1a0601cb8f9bcdc9fb6d93747ca50

See more details on using hashes here.

File details

Details for the file mgrs-1.3.8-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mgrs-1.3.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a2ed0b47c3074cb04b4490b141b96d7291e43c4a2b9bd2c19480e667cfe05cb2
MD5 71b0ea9eb57b22529dbc2c0d40dcc507
BLAKE2b-256 358f1c00ecea2b0451bcbb365c244eb1f2ccf68453b93ae2a9319105374186d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.8-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for mgrs-1.3.8-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 76dbeb0e00ce5f0fcaac48c039b81543b403671a810c5aa60f3bd105692a1c88
MD5 5faef8b553299a9792a657ef37628f1a
BLAKE2b-256 1676ef6336c1197587170c5823f9c8a04bbe7b8085513bdeb8d0b270149c0497

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