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.

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)

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.0.1.tar.gz (25.6 kB view hashes)

Uploaded Source

Built Distributions

mgrs-1.0.1.win32-py2.7.exe (214.8 kB view hashes)

Uploaded Source

mgrs-1.0.1.win32-py2.6.exe (84.9 kB view hashes)

Uploaded Source

mgrs-1.0.1.win32-py2.5.exe (77.8 kB view hashes)

Uploaded Source

mgrs-1.0.1.win32-py2.4.exe (77.8 kB view hashes)

Uploaded Source

mgrs-1.0.1-py2.7-win32.egg (19.2 kB view hashes)

Uploaded Source

mgrs-1.0.1-py2.6-win32.egg (19.3 kB view hashes)

Uploaded Source

mgrs-1.0.1-py2.5-win32.egg (16.9 kB view hashes)

Uploaded Source

mgrs-1.0.1-py2.4-win32.egg (16.9 kB view hashes)

Uploaded Source

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