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.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.3.5.zip (43.6 kB view details)

Uploaded Source

Built Distributions

mgrs-1.3.5-cp37-cp37m-win_amd64.whl (22.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

mgrs-1.3.5-cp36-cp36m-win_amd64.whl (21.9 kB view details)

Uploaded CPython 3.6m Windows x86-64

mgrs-1.3.5-cp35-cp35m-win_amd64.whl (21.9 kB view details)

Uploaded CPython 3.5m Windows x86-64

mgrs-1.3.5-cp27-cp27m-win32.whl (19.4 kB view details)

Uploaded CPython 2.7m Windows x86

File details

Details for the file mgrs-1.3.5.zip.

File metadata

  • Download URL: mgrs-1.3.5.zip
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mgrs-1.3.5.zip
Algorithm Hash digest
SHA256 b8e4eaab7a4057910dd18fce9047ab2487a9d43a5c205510465709f62156d02c
MD5 2a996b9993678d53e04247013a5de74f
BLAKE2b-256 1d497abb4403bd44971fa5b75e9deb904ada7c545660dc0704ea79c776d59c49

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mgrs-1.3.5-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for mgrs-1.3.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b97039da9efa7c2e71e59a6063d083627b089496571e3f335580e83da6324c38
MD5 684dfb116be6210a93911acab432374b
BLAKE2b-256 3472dbbd718dd311d1398786a32955e225b60ea65260f4af19807dee4ca94655

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mgrs-1.3.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5565c150ccba0c01dc36ca7ed419b8cbbe974d5167a11f04d31241082f6d596f
MD5 0142f8ea9cfe4a3725ebd20479c01dd2
BLAKE2b-256 3823d518958de5e2087c1bb37ec7d23957a5f77d39571da1a1f766ac8fa77187

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mgrs-1.3.5-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 113020ae5e6fb974856888f8798ff0da8710bb17b3ff177bfb12ca20c81bce88
MD5 b667378450717285bf01f5aef139415f
BLAKE2b-256 6030a6daa50f2d16d16a44d6e358476d06819aa6032b541d2418143e7b54f4ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mgrs-1.3.5-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 e544c7706033e666ea0922e2c2cba6fdd8feeaeb6f8bfa52e0023066f05d44c1
MD5 01c59263fdf876d02e8e9ecb799ab843
BLAKE2b-256 dafa16601f27f92bc98ba976b1174fb2a53d77ac538be4cd5b8fdceee204af12

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