Feature request #13387

Print composer grid coordinate formater should provide variables for current DMS values

Added by marisn - over 8 years ago. Updated almost 7 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:21439

Description

This is a reopening of #12472 as current implementation, as provided by fixing #9292, is far from being usable and I, as a reporter of #12472, can not reopen it.

Even after implementing custom grid annotation formatting, adding a DMS with a correct text is more like a rocket science than a usable feature.

Use case: add a grid in WGS84 CRS with labels in format DMS + label «24°00'00.0"E».

Current option "DMS with Suffix" will provide «24°00'00.0"A» ("A" stands for "Austrumi" in Latvian) and the only way how to change "A" to "E" is to change the QGIS GUI language into English. Sucks, but somehow works.
e8c3afa3984cee32b98b52ba65bcf5ed630ae72d adds a "custom" grid annotation formatting option. The only issue - there is no shortcut to get DMS or to get current direction of coordinate axis. It provides two variables "@grid_number" - line coordinate in decimal degrees and "@grid_axis" - "X" or "Y" value where "X" means longitude and "Y" means latitude. Converting @grid_number from DD to DMS and providing correct label (N,E,S,W) is left as an exercise to reader.

"Exercise to reader" is a bit too complicated to be considered a suitable solution for average QGIS user. Here follows a non-working example that could be used to provide labels for Easting. Rinse and repeat for W, N and S (after spotting the mistake I have made in the code).

case 
when @grid_axis == 'x' and  @grid_number > 0 then format("%1°%2'%3\\"E",  floor(  @grid_number ), floor(( @grid_number - floor(  @grid_number )) * 60), ( @grid_number - floor(( @grid_number - floor(  @grid_number )) * 60)) * 3600)
end

The solution could cover two aspects (implementing one of them does not invalidate the second one):
  1. for existing DMS + Suffix labels provide a configuration option where user can type-in labels for E,S,W,N directions (dummy friendly version);
  2. for "custom" label formatter to provide variables with (Boeing pilot version):
    1. current D, M, S values (thus allowing format('%1deg %2min %3sec', @grid_deg, @grid_min, @grid_sec))
    2. current label quadrant as static value (N,E,S,W) (it would allow if(@grid_quad 'N', 'Ziemeļi'))

History

#1 Updated by Nyall Dawson over 8 years ago

  • Assignee deleted (Nyall Dawson)

for "custom" label formatter to provide variables with (Boeing pilot version):

current D, M, S values (thus allowing format('%1deg %2min %3sec', @grid_deg, @grid_min, @grid_sec))
current label quadrant as static value (N,E,S,W) (it would allow if(@grid_quad 'N', 'Ziemeļi'))

Sounds like a good approach. Just a note though, please don't assign people to Feature Request tickets unless you've discussed with them in advance. Assignee is used to indicate that someone is either actively working on something or (for a bug) that they broke something and they need to fix it ;)

#2 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No

Also available in: Atom PDF