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.

ChangeLog

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

Uploaded Source

Built Distributions

mgrs-1.3.4-cp36-cp36m-win_amd64.whl (21.8 kB view details)

Uploaded CPython 3.6m Windows x86-64

mgrs-1.3.4-cp35-cp35m-win_amd64.whl (21.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

mgrs-1.3.4-cp27-cp27m-win32.whl (19.3 kB view details)

Uploaded CPython 2.7m Windows x86

File details

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

File metadata

  • Download URL: mgrs-1.3.4.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mgrs-1.3.4.tar.gz
Algorithm Hash digest
SHA256 2740fe58d10c99cfd277311e1ceb491bc55bf5f417dbdd1e3d901ef2e1072fff
MD5 e2debe373ccfbd7a80434f522dd57a56
BLAKE2b-256 e7fa07a036a01e7e7ec91a089788629c2da3ddc8769200652b7e2db1edce932e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mgrs-1.3.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5fefd9b9e95287b280fa5ce844d8e7215548081497c900bfa2e50f13f1f132ed
MD5 6e871d293d84776091a3c01b82c8eea9
BLAKE2b-256 f71cb79f94164b2bf3930148912d20906188d8f6fdb969c80508f0d0c5351145

See more details on using hashes here.

File details

Details for the file mgrs-1.3.4-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for mgrs-1.3.4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 fa55fd2a19b9ec9ae473e9d200b3ba1d35b392e9b9e763fdec37471517baf0c6
MD5 6ba7e7f1cdf0cd1e15d41ee55849cba2
BLAKE2b-256 45e86effbc95caa35e24be48e13ede63c5e422fd6a680a1130b014ca06520f73

See more details on using hashes here.

File details

Details for the file mgrs-1.3.4-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for mgrs-1.3.4-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 4153b0dd5013854df362956fcbb11b72bbdd58f6d4ab8eab192a6dc20e4a332c
MD5 668d533a32a73c9a667da461742d1ca8
BLAKE2b-256 4543ec2acfa2b1c33def88085d82654d785ff1ad39e8fed802bd87b5ab839375

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