Skip to main content

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.

Metadata

Release files for mgrs 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mgrs 1.4.0
File Size Uploaded Provenance Actions
mgrs-1.4.0.tar.gz 31.8 kB Without provenance Details for mgrs-1.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mgrs 1.4.0
File Actions
mgrs-1.4.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for mgrs-1.4.0-cp38-cp38-win_amd64.whl
mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details for mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl
mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details for mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl
mgrs-1.4.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for mgrs-1.4.0-cp37-cp37m-win_amd64.whl
mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details for mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
mgrs-1.4.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for mgrs-1.4.0-cp36-cp36m-win_amd64.whl
mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 Details for mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl

Total release size: 309.8 kB

Release files / mgrs-1.4.0.tar.gz

Download URL mgrs-1.4.0.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0bee926019fce23dd32f9698ff0ca329447133a78f16971a83891ad759f91a20
BLAKE2b-256 checksum
How to use checksums
91a770bba9b5fe6136221be074a2987744ce1360ed561eb34ef34e5f46b445f1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp38-cp38-win_amd64.whl

Download URL mgrs-1.4.0-cp38-cp38-win_amd64.whl
Size 23.2 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
a82524e10e42322aa1470c72859908b25b15a234c120a6849ab9d7ac40383eba
BLAKE2b-256 checksum
How to use checksums
091b2e1328c1402217d2d9ba3eccfa8b53cfd09c9d0671e93b647fef231e8976
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl

Download URL mgrs-1.4.0-cp38-cp38-manylinux1_x86_64.whl
Size 47.6 kB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
1c8ab0fdcb4235f7a7ab50fae3ed57a8763007505657f55cbc0066e9f104f8b2
BLAKE2b-256 checksum
How to use checksums
c663837999477b65e9e815526d514bef1d0ea87f1a615adec1acc739218230a2
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl

Download URL mgrs-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl
Size 21.9 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
cd7e78d63ca73e7340076ebdaf497a1b76432cc65d8994efb02c3f1cbc4301ac
BLAKE2b-256 checksum
How to use checksums
2654a28bf31f54d8704afd95a2e8b3cc1ba3893affbfd98b65406e226e2511ba
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp37-cp37m-win_amd64.whl

Download URL mgrs-1.4.0-cp37-cp37m-win_amd64.whl
Size 23.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
fd08782887baf09fb426aae4892a57f681e4aebd60e0bcd35e7bb9826cf08109
BLAKE2b-256 checksum
How to use checksums
a33c3692ef49b6da8f24e11034a00d3728a86addf2488231dc4104b99f143735
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl

Download URL mgrs-1.4.0-cp37-cp37m-manylinux1_x86_64.whl
Size 47.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
5843e5aab8ed0dc479536fc00eb244f9f5ea97e67abf6523134484a826b78393
BLAKE2b-256 checksum
How to use checksums
e416d7f14c8e92da53798396428d715ba161bfbff1f7c2db0ec9d796e1354308
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL mgrs-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
Size 21.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
e376454b299c76e9ee19ed2b4e6929952adda3450be258f1179beb66946b4012
BLAKE2b-256 checksum
How to use checksums
792f05f595898aa947d0f310897ac8c7f4dda91f26bb82ab8fbd6e433288ee7b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp36-cp36m-win_amd64.whl

Download URL mgrs-1.4.0-cp36-cp36m-win_amd64.whl
Size 23.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
d3e086a90c086109096a6096963ae9397c29dc5136319906e122d58473a28a6d
BLAKE2b-256 checksum
How to use checksums
9cd6a3bf26609ee77dd80219ff0948fa1b67ece75d00c274e4c535d7a69c16a5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl

Download URL mgrs-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
Size 47.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
cdebd39056d0cb414d895283c08630a004b444f9f1dab76ce55d870e6942caac
BLAKE2b-256 checksum
How to use checksums
8e051a6a87c992942b137a3a2b42101b85c708983b4306cc27e59cc9650dbfcc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl

Download URL mgrs-1.4.0-cp36-cp36m-macosx_10_14_x86_64.whl
Size 21.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
1c99877bfe8ba68d94bc0c1bc73b8401cce558fe767bf14df20031c916aa9088
BLAKE2b-256 checksum
How to use checksums
ba3951c5e2accef328392facfa98ad9a5c369918f6ff4283284adc4c8f394ceb
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for mgrs 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page