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) >>> y = '321942.29N' >>> yd = m.dmstodd(y) 32.328414 >>> 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
Release history Release notifications | RSS feed
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.1.0.tar.gz
(26.6 kB
view details)
File details
Details for the file mgrs-1.1.0.tar.gz
.
File metadata
- Download URL: mgrs-1.1.0.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f35bf0eda06b00906ce86def3471693ed01c8ab697345ea81db5aa80843ff9d |
|
MD5 | 96e0c00f16d86a3f8b84c2c46cb68b8e |
|
BLAKE2b-256 | 290de216e6eaf0209a954ef16e7233adb20214e3f339038fccac1c3b0229ac7f |