UTM zones in GMT Documentation are actually MGRS zones + associated confusion
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- bash
- Domain
- cli, documentation
Research direction
Start with the UTM section of the GMT cookbook page linked in the issue and reproduce the supplied Bash commands with GMT 6.4.0. Update the documentation to distinguish UTM from MGRS, explain the required '+' north of the equator, and clarify EPSG handling; document or explicitly defer the code-level validation requests after maintainer confirmation.
Written by the indexing model from the issue text.
Description
This is all pretty low priority and it's a bit extreme to call them bugs, putting this here as a record and for people like me who got confused. May try to do some of the Doc updating myself if I can figure out how.
Suggested fixes (the tldr)
- Update Documentation to add "MGRS" subheading and put current UTM figure in there, making clear those are MGRS latitude codes
- Update Documentation to explicitly state that a "+" is needed to indicate "UTM north of equator"
- Adding a figure from PROJ to replace current UTM Figure
- If EPSG specifications are allowed, document how to use them, as this is useful when working with this data.
--- I can't do the below ----
- Add routines to catch people not adding + or - when specifying UTM projection without latitude code: i.e.
-Ju34/1:xxxxxand throw an error along the lines ofERROR: UTM projection insufficiently specified - did you forget to add a latitude code or +/-?because at the moment the error message implies the -R value is wrong. - Adding routines to catch when people are using EPSG codes wrong for UTM (if this is not supported then a routine to say "this is not supported").
Description of the problems in detail
I have had a few related issues with how UTM coordinates get handled in GMT. I'm happy to handle some of the documentation changes myself if I can, but recording them all here as an issue so it's formalised.
GMT documentation on UTM refers to latitude zones that don't appear in GIS software such as QGIS or packages such as PROJ, or in the EPSG system. It turns out these latitude zones are a feature in the US Army's MGRS grid system, so not really a UTM feature. It might be good to make this clear because UTM zones are split into north (N) and south (S) of the equator in other GIS software, and confusingly MGRS has those letters as latitude zones, but both are north of the equator! Modifying the documentation to point out this difference will save a lot of confusion for newer users. Good article on the difference between UTM and MGRS here.
ISSUE 1
In the GMT documentation on UTM it says
UTM zone (A, B, 1–60, Y, Z). Use negative values for numerical zones in the southern hemisphere or append the latitude modifiers (C–H, J–N, P–X) to specify an exact UTM grid zone.
and
Furthermore, each zone is divided into latitude bands but these are not needed to specify the projection for most cases
This only works in the north if you use a "+" (-Ju+31/1:xxxxx) if you leave it blank (-Ju31/1:xxxx) and assume that counts as a "positive number" you get thrown a misleading -R parsing error:
coast [ERROR]: UTM projection insufficiently specified to auto-determine geographic region
coast [ERROR]: Option -R parsing failure. Correct syntax:
....
....
coast [ERROR]: Offending option -R353932.665723/429763.511095/5618692.59768/5692923.34264+ue
I suggest adding a line in the documentation to explicitly say "you need a plus when not specifying a MGRS latitude zone north of the equator".
ISSUE 2
If using data projected in EPSG:32631 (UTM 31N) you get some weird effects
-Ju31(N-Z) -- correct for all zone specifications
-Ju31(A-M) -- incorrect for all zone specifications (thinks you're in the southern hemisphere)
This is probably not a priority because if someone just looks at the chart and uses a MGRS zone that is approximately right, then it works! But it is confusing.
I suggest updating documentation to state the difference between UTM and MGRS and that MGRS codes have nothing to do with UTM as understood by most GIS software.
ISSUE 3
Specifying your projection using the EPSG code you projected it into doesn't work, but it's difficult to tell if this is because EPSG codes are not supported, or if the -R argument is wrong:
Using:
-J"EPSG:32631/1:650000"
Results in a similar misleading -R parsing error for Issue 1 (you get a similar error if you try to do it with -R${gridfile} like in Example 28)
coast [ERROR]: UTM projection insufficiently specified to auto-determine geographic region
coast [ERROR]: Option -R parsing failure. Correct syntax:
...
...
coast [ERROR]: Offending option -R353932.665723/429763.511095/5618692.59768/5692923.34264+ue
I suggest routines that either catch people using EPSG codes and telling them it's not allowed, or updating documentation to reflect how they actually work, because I don't understand how this is insufficiently specified.
Code to replicate these issues:
Here is some code that replicates these issues, with a small DEM attached, projected into EPSG:32631 (UTM 31N)
test_dem.zip
#!/bin/bash
# gmt version 6.4.0
file='bash-gmt-utm-test'
bounds="-R353932.665723/429763.511095/5618692.59768/5692923.34264+ue"
gmt grdconvert test_dem1.tif -Gtest_dem.grd
grid=test_dem.grd
gmt begin $file
gmt grdimage $grid -Jx1:650000
gmt basemap $bounds -Jx1:650000 -B20000g20000+u"@:8:m@::" -BesNE --FONT_ANNOT_PRIMARY=10p --MAP_GRID_CROSS_SIZE_PRIMARY=0.25c --FONT_LABEL=10p
# "correct" MGRS ZONE -- plots correct frame
gmt coast $bounds -Ju31U/1:650000 -Df -B -Ia -W
# "incorrect" MGRS ZONES (above the equator) -- plots correct frame
gmt coast $bounds -Ju31S/1:650000 -Df -B -Ia -W
gmt coast $bounds -J"EPSG:32631/1:650000" -Df -B -Ia -W
# "incorrect" MGRS ZONE (below the equator) -- plots incorrect frame
gmt coast $bounds -Ju31D/1:650000 -Df -B -Ia -W
# UTM without any latitude zone -- throws a -R parsing error
gmt coast $bounds -Ju31/1:650000 -Df -B -Ia -W
# UTM specified using the EPSG code
gmt coast $bounds -J"EPSG:32631/1:650000" -Df -B -Ia -W
# Region specified using grid
gmt coast -R$grid -J"EPSG:32631/1:650000" -Df -B -Ia -W
gmt end show
- Dominant language
- C
- Stars
- 997
- Forks
- 420
- Avg merge
- 13h 27m
- Merged PRs (30d)
- 47
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenericMappingTools/gmt
-
Add support for SCM 9.0.0 to GMTPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
GenericMappingTools/gmt#9316 · 10 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
GenericMappingTools/gmt#5767 · 15 comments ·
Maintainers usually reply within 1 day
-
discussion
Difficulty 5/5 Over a week Newbie friendliness 35/100
GenericMappingTools/gmt#9343 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
GenericMappingTools/gmt#9331 · 1 reaction ·
Maintainers usually reply within 1 day
-
histogram: the min/max setting in -T is ignored when -R is setPossibly taken @seisman claimed this 1 day ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
GenericMappingTools/gmt#9330 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GenericMappingTools/gmt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
espressif/esp-iot-solution#856 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Broken links in reference manualPossibly taken @farisbasha claimed this 14 days ago. Opencore:meson
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mpv-player/mpv#18934 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100