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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl (21.9 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl (21.9 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl (21.9 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: mgrs-1.4.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0.tar.gz
Algorithm Hash digest
SHA256 0bee926019fce23dd32f9698ff0ca329447133a78f16971a83891ad759f91a20
MD5 e5325c7861e7750f22ca89d7f36dda08
BLAKE2b-256 91a770bba9b5fe6136221be074a2987744ce1360ed561eb34ef34e5f46b445f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a82524e10e42322aa1470c72859908b25b15a234c120a6849ab9d7ac40383eba
MD5 9725a5426f4e9926c79ccd95ca9d29ab
BLAKE2b-256 091b2e1328c1402217d2d9ba3eccfa8b53cfd09c9d0671e93b647fef231e8976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1c8ab0fdcb4235f7a7ab50fae3ed57a8763007505657f55cbc0066e9f104f8b2
MD5 3d651c94252de718a30545ca35a9d9b0
BLAKE2b-256 c663837999477b65e9e815526d514bef1d0ea87f1a615adec1acc739218230a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.9 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 cd7e78d63ca73e7340076ebdaf497a1b76432cc65d8994efb02c3f1cbc4301ac
MD5 d7b67fd5ae22899a24eddd4d1e570c7f
BLAKE2b-256 2654a28bf31f54d8704afd95a2e8b3cc1ba3893affbfd98b65406e226e2511ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 fd08782887baf09fb426aae4892a57f681e4aebd60e0bcd35e7bb9826cf08109
MD5 61932ab79428a8522b0607fa4c17d36c
BLAKE2b-256 a33c3692ef49b6da8f24e11034a00d3728a86addf2488231dc4104b99f143735

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5843e5aab8ed0dc479536fc00eb244f9f5ea97e67abf6523134484a826b78393
MD5 be97849a7d02d7fa303ca1a4095afd48
BLAKE2b-256 e416d7f14c8e92da53798396428d715ba161bfbff1f7c2db0ec9d796e1354308

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.9 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e376454b299c76e9ee19ed2b4e6929952adda3450be258f1179beb66946b4012
MD5 257cd318a14b9641a7dc6ec665badcb4
BLAKE2b-256 792f05f595898aa947d0f310897ac8c7f4dda91f26bb82ab8fbd6e433288ee7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d3e086a90c086109096a6096963ae9397c29dc5136319906e122d58473a28a6d
MD5 a900e0a07f7a973521ec917f5530689f
BLAKE2b-256 9cd6a3bf26609ee77dd80219ff0948fa1b67ece75d00c274e4c535d7a69c16a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 47.6 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cdebd39056d0cb414d895283c08630a004b444f9f1dab76ce55d870e6942caac
MD5 70f8d988fd1f2726621c8d86bda91dad
BLAKE2b-256 8e051a6a87c992942b137a3a2b42101b85c708983b4306cc27e59cc9650dbfcc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.9 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/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 1c99877bfe8ba68d94bc0c1bc73b8401cce558fe767bf14df20031c916aa9088
MD5 686f226a6fe51e7923d6b4269ee34fa1
BLAKE2b-256 ba3951c5e2accef328392facfa98ad9a5c369918f6ff4283284adc4c8f394ceb

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