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.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.

Metadata

Release files for mgrs 1.4.2

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.2
File Size Uploaded Provenance Actions
mgrs-1.4.2.tar.gz 31.5 kB Without provenance Details for mgrs-1.4.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mgrs 1.4.2
File Actions
mgrs-1.4.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for mgrs-1.4.2-cp38-cp38-win_amd64.whl
mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details for mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details for mgrs-1.4.2-cp38-cp38-macosx_10_14_x86_64.whl
mgrs-1.4.2-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details for mgrs-1.4.2-cp37-cp37m-win_amd64.whl
mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
mgrs-1.4.2-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.2-cp37-cp37m-macosx_10_14_x86_64.whl
mgrs-1.4.2-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details for mgrs-1.4.2-cp36-cp36m-win_amd64.whl
mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
mgrs-1.4.2-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.2-cp36-cp36m-macosx_10_14_x86_64.whl

Total release size: 309.4 kB

Release files / mgrs-1.4.2.tar.gz

Download URL mgrs-1.4.2.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12dd1c994d1e3e0ce17e62eeab01243c6f1e6de6a4423dc9d1bcbd84b7448948
BLAKE2b-256 checksum
How to use checksums
f3367114872ab5aa64b73b8cae1b300152b7ad5f6fa785c9becfbca530534737
Upload date
Uploaded using Trusted Publishing?
What is 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

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

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

Release files / mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL mgrs-1.4.2-cp38-cp38-manylinux_2_5_x86_64.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
0f9d2eb2280014d448fb1f551457d3d42c43c8d77dd9f77bf763a28443627833
BLAKE2b-256 checksum
How to use checksums
d5fcc397102df2f672c7b4711c1ff73815b9ddd5317eaa28557579b9cfaa84ee
Upload date
Uploaded using Trusted Publishing?
What is 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

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

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

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

Download URL mgrs-1.4.2-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
8dd7512fc41d8a21935ab994c0a64865023a64630b4cd04693c3ab4214383881
BLAKE2b-256 checksum
How to use checksums
4fc919a9d24a598a0786419c124f5cafa50ab58014da56b8eca9fb67b41e8689
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL mgrs-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.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
6f93b404069791d5e1e146a9cff64cc8f44d942bb98a7046077ae546866ba52f
BLAKE2b-256 checksum
How to use checksums
02e74b049e052fc604291c083029b51cfcb3c7225e7dacb91ee9dc85ece43383
Upload date
Uploaded using Trusted Publishing?
What is 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

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

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

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

Download URL mgrs-1.4.2-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
5309258228c00fefae456a9913b39524ed2e6e4e72179c75f94cae4daef14835
BLAKE2b-256 checksum
How to use checksums
e701d9a3e191f5bcce6616f1a1d462c5b4acecd497250065706689abbef50363
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL mgrs-1.4.2-cp36-cp36m-manylinux_2_5_x86_64.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
780e592df4af715ab6938b301acd108a587f255469c9535536012e41a2845c3b
BLAKE2b-256 checksum
How to use checksums
3a644e14b225b04485271499c9c2ac96fa6f8e7f2884690ba7c85db531081445
Upload date
Uploaded using Trusted Publishing?
What is 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

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

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

Security for mgrs 1.4.2

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