mgrs
MGRS coordinate conversion for Python
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 mgrsuv
uv add mgrspoetry
poetry add mgrsInstalling 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
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
lat-lon-parserParses latitude-longitude coordinate strings in…
permissive · top 15,000 on PyPI
convertbngConverts decimal WGS84 longitude/latitude…
unclear · top 15,000 on PyPI
pystac-ext-mgrsAdds MGRS (Military Grid Reference System)…
permissive · top 5,000 on PyPI
utmConverts between latitude/longitude coordinates…
permissive · top 5,000 on PyPI
haversineCalculates great-circle distances between…
permissive · top 5,000 on PyPI
geohash2Encodes latitude/longitude coordinates to…
agpl · top 5,000 on PyPI
reverse_geocoderReverse Geocoder converts latitude/longitude…
copyleft · top 15,000 on PyPI
pynmea2Parses and generates NMEA 0183 sentences from…
permissive · top 15,000 on PyPI
pynmeagpsParses and generates NMEA 0183 GPS/GNSS…
permissive · top 15,000 on PyPI
pymap3dConverts between geographic and 3-D coordinate…
permissive · top 15,000 on PyPI