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

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.3.8
File Size Uploaded Provenance Actions
mgrs-1.3.8.tar.gz 32.4 kB Without provenance Details for mgrs-1.3.8.tar.gz

Built distributions (wheels)

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

Total release size: 305.1 kB

Release files / mgrs-1.3.8.tar.gz

Download URL mgrs-1.3.8.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5ba69009201cb0f3b333fbd098dcf565f5b9d1d04fc5ef9a2c97fd206b7eebac
BLAKE2b-256 checksum
How to use checksums
7be80bfe081e4cf62886b5e1f7afff5602511c6b7e839fc8cdd515dd911904c8
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp38-cp38-win_amd64.whl
Size 22.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
f13e87df0c7fddfd21634ae7134e483373536776dce29396ff9a42fab6c2df2a
BLAKE2b-256 checksum
How to use checksums
9bc00f2e930a9dcfdfbabfb75a4ca134104cfbaaf2ae7aa401dfd020a7344179
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp38-cp38-manylinux1_x86_64.whl
Size 47.0 kB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
448f5ede320abd2b7c7b68127c02ad31b2c0da73c8d0e03223e0eadad89b648d
BLAKE2b-256 checksum
How to use checksums
c7af370c620fbafc4722676f1eb68de3b7dd15204a98b8e49127e4089a7080b0
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp38-cp38-macosx_10_14_x86_64.whl
Size 21.3 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
6480cb03a9671d4eeb74f45bd100ccc2375b9cc5d59898b102ff172a24a2c03c
BLAKE2b-256 checksum
How to use checksums
1a66c49f0f3e9afded3dc50f408fa477813807991b72ccd8881f9da59d227389
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp37-cp37m-win_amd64.whl
Size 22.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
2ef0a92bb03a58900a2925840cf0de47c977ecfc45d16fe41dab5d05b8ee5811
BLAKE2b-256 checksum
How to use checksums
e93cac05398c6182cf06482cbc3e1f2f92a97556484d888b33874ee0f129c94a
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp37-cp37m-manylinux1_x86_64.whl
Size 47.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b642af6bd7d8f783fb1fc4841c155782911ef3566d99b8eac5b2a0e185076424
BLAKE2b-256 checksum
How to use checksums
762019c89bb147fda7ef6649fc79578612da10f222c20751d2cf8cca1ff61d9f
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp37-cp37m-macosx_10_14_x86_64.whl
Size 21.3 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
2addec7a1f896284a5b9f16e4e5cf83d17ad6aab21cbdf06b413f70935e0cd06
BLAKE2b-256 checksum
How to use checksums
0fb7fef1590050b7aaec506428c4509da09fbb6f115d04c80007c97a4433d58c
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp36-cp36m-win_amd64.whl
Size 22.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
eef37c8cab08cd770659fb9b8374237d4711e9c0e0d33430c13d3ca46d203863
BLAKE2b-256 checksum
How to use checksums
c946a7f8c40907b714b821f82435a91e8de1a0601cb8f9bcdc9fb6d93747ca50
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp36-cp36m-manylinux1_x86_64.whl
Size 47.0 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
a2ed0b47c3074cb04b4490b141b96d7291e43c4a2b9bd2c19480e667cfe05cb2
BLAKE2b-256 checksum
How to use checksums
358f1c00ecea2b0451bcbb365c244eb1f2ccf68453b93ae2a9319105374186d6
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

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

Download URL mgrs-1.3.8-cp36-cp36m-macosx_10_14_x86_64.whl
Size 21.3 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
76dbeb0e00ce5f0fcaac48c039b81543b403671a810c5aa60f3bd105692a1c88
BLAKE2b-256 checksum
How to use checksums
1676ef6336c1197587170c5823f9c8a04bbe7b8085513bdeb8d0b270149c0497
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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Security for mgrs 1.3.8

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