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.






  • Better Windows support
  • Bug fix for 3 digit longitudes


  • Python 3.x support
  • Allow user to override precision in UTMToMGRS


In a nutshell:

>>> import mgrs

>>> latitude = 42.0
>>> longitude = -93.0

>>> m = mgrs.MGRS()
>>> c = m.toMGRS(latitude, longitude)
>>> c

>>> d = m.toLatLon(c)
>>> d
(41.999997975127997, -93.000000000000014)

>>> y = '321942.29N'
>>> yd = m.dmstodd(y)

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

Filename, size & hash SHA256 hash help File type Python version Upload date
mgrs-1.3.5-cp27-cp27m-win32.whl (19.4 kB) Copy SHA256 hash SHA256 Wheel 2.7
mgrs-1.3.5-cp35-cp35m-win_amd64.whl (21.9 kB) Copy SHA256 hash SHA256 Wheel 3.5
mgrs-1.3.5-cp36-cp36m-win_amd64.whl (21.9 kB) Copy SHA256 hash SHA256 Wheel 3.6
mgrs-1.3.5-cp37-cp37m-win_amd64.whl (22.0 kB) Copy SHA256 hash SHA256 Wheel 3.7 (43.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page