skillfed

mgrs

MGRS coordinate conversion for Python

mgrs v1.5.4 269.6K downloads/30d#8,258 on PyPI133
Permissive license The MIT License (MIT) Copyright (c) 2016 Howard Butler <howard@hobu.co> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation… (full text in the JSON record) AGING released

What it is and what it does

mgrs is a Python wrapper around GeoTrans C code that handles bidirectional conversion between MGRS grid coordinates and decimal degree latitude/longitude. It provides methods to convert lat/lon pairs to MGRS strings, reverse that conversion, and handle degree-minute-second (DMS) format. The package bundles an internal copy of GeoTrans 2.4.2 files and exposes the conversion logic through a simple Python class.

The library is designed for GIS and geospatial applications where military or scientific coordinate systems are needed. It has no runtime dependencies beyond Python itself, making it lightweight to integrate. Wheels are pre-built for Python 3.9–3.12 across Linux, macOS, and Windows architectures, reducing installation friction on common platforms.

Use it for:

  • Convert GPS coordinates from a field survey to MGRS format for military or defense mapping applications.
  • Transform MGRS grid references back to decimal degrees for display on web maps or GIS software.
  • Batch process geographic data that mixes coordinate systems in geospatial data pipelines.
  • Parse and validate MGRS strings in location-based services or emergency response systems.
  • Convert between DMS (degrees-minutes-seconds) and decimal degree formats in surveying workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts between MGRS (Military Grid Reference System) coordinates and decimal degrees latitude/longitude using a ctypes wrapper around GeoTrans C code.

Yes, if you need MGRS coordinate conversion in a Python GIS or geospatial application. The package is stable, permissively licensed, has no dependencies, and offers pre-built wheels for modern Python versions. Install friction is moderate due to compiled components, but that is typical for geospatial libraries. The aging maintenance status (192 days since last release) is acceptable for a mature, feature-complete library with no known vulnerabilities.

Install

mgrs on PyPI

pip

pip install mgrs

uv

uv add mgrs

poetry

poetry add mgrs

Installing mgrs

Before you install

Medium install friction due to compiled wheels for multiple platforms and Python versions (3.9–3.12). Package is aging but stable; last release 192 days ago with active repository (133 stars, last commit 2026-02-03). No runtime dependencies simplifies deployment.

License in practice

MIT license (permissive) permits commercial and private use with minimal restrictions; attribution required but no copyleft obligations.

Quickstart

import mgrs

m = mgrs.MGRS()
latitude, longitude = 42.0, -93.0
mgrs_string = m.toMGRS(latitude, longitude)
print(mgrs_string)  # '15TWG0000049776'

coords = m.toLatLon(mgrs_string)
print(coords)  # (41.999997975127997, -93.000000000000014)

Requires Python 3.9 or later; compiled wheels available for common platforms (Linux x86_64/aarch64, macOS, Windows) but may require build tools on unsupported architectures.

Verify before relying

  • Precision control via MGRSPrecision parameter mentioned in description but not detailed in fact sheet
  • Performance characteristics for large-scale coordinate batch conversions
  • Accuracy guarantees relative to official GeoTrans implementation

Package facts

License The MIT License (MIT) Copyright (c) 2016 Howard Butler <howard@hobu.co> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 192 days since the last release
Last repo commit
First released
Downloads 269,550/month — #8,258 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mgrs-1.5.4-cp310-cp310-macosx_10_9_x86_64.whl; mgrs-1.5.4-cp310-cp310-macosx_11_0_arm64.whl; mgrs-1.5.4-cp310-cp310-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl; mgrs-1.5.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; mgrs-1.5.4-cp310-cp310-musllinux_1_2_aarch64.whl; mgrs-1.5.4-cp310-cp310-musllinux_1_2_x86_64.whl; mgrs-1.5.4-cp310-cp310-win32.whl; mgrs-1.5.4-cp310-cp310-win_amd64.whl; mgrs-1.5.4-cp310-cp310-win_arm64.whl; mgrs-1.5.4-cp311-cp311-macosx_10_9_x86_64.whl; mgrs-1.5.4-cp311-cp311-macosx_11_0_arm64.whl; mgrs-1.5.4-cp311-cp311-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl; mgrs-1.5.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; mgrs-1.5.4-cp311-cp311-musllinux_1_2_aarch64.whl; mgrs-1.5.4-cp311-cp311-musllinux_1_2_x86_64.whl; mgrs-1.5.4-cp311-cp311-win32.whl; mgrs-1.5.4-cp311-cp311-win_amd64.whl; mgrs-1.5.4-cp311-cp311-win_arm64.whl; mgrs-1.5.4-cp312-cp312-macosx_10_13_x86_64.whl; mgrs-1.5.4-cp312-cp312-macosx_11_0_arm64.whl

Keywords: gis, coordinate, conversion

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: GIS

Tags

MGRS coordinate conversionmilitary grid reference systemlat lon to MGRSdecimal degrees conversiongeographic coordinate transformationGIS coordinate systemsUTM to MGRS conversion
giscoordinate-systemsgeospatial

More GIS packages