{"library":"mgrs","title":"MGRS Coordinate Conversion for Python","description":"The `mgrs` Python library (version 1.5.4) provides a simple `ctypes` wrapper around selected MGRS-related C functions from GeoTrans (version 2.4.2), an internal copy of which is included within the library. It facilitates conversions to and from Military Grid Reference System (MGRS) coordinates and decimal degrees (latitude/longitude), offering various precision levels. The library is actively maintained, with a recent release in February 2026.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install mgrs"],"cli":null},"imports":["from mgrs import MGRS"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from mgrs import MGRS\n\nm = MGRS()\n\n# Convert Latitude/Longitude to MGRS\nlatitude = 42.0\nlongitude = -93.0\nmgrs_coords = m.toMGRS(latitude, longitude)\nprint(f\"({latitude}, {longitude}) -> {mgrs_coords}\")\n\n# Convert MGRS to Latitude/Longitude\nlat_lon_coords = m.toLatLon(mgrs_coords)\nprint(f\"{mgrs_coords} -> {lat_lon_coords}\")\n\n# Convert DMS to Decimal Degrees\ndms_str = '321942.29N'\ndec_deg = m.dmstodd(dms_str)\nprint(f\"{dms_str} -> {dec_deg}\")\n\n# Convert Decimal Degrees to DMS\nd, minute, s = m.ddtodms(dec_deg)\nprint(f\"{dec_deg} -> (D:{d}, M:{minute}, S:{s}))\")","lang":"python","description":"This quickstart demonstrates how to initialize the MGRS converter and perform common operations such as converting between latitude/longitude and MGRS, and between Degrees-Minutes-Seconds (DMS) strings and decimal degrees. Precision can also be controlled in `toMGRS()`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"1.5.4","pypi_latest":"1.5.4","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"18.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"19.9M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.8M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.4,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"17.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"mgrs","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"18M"}]}}