Bug #708

mapproject -C gives low precision for large scales

Added by Paul about 2 years ago. Updated about 2 years ago.

Status:ClosedStart date:2015-05-24
Priority:NormalDue date:
Assignee:Paul% Done:

0%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:

Description

Since mapproject uses the general GMT plot-centric projections we always subtract the map projection origin coordinate and then apply a scale. However, with -C we then proceed to undo the scaling and origin shift. When the origin is huge (i.e., using -Rg with -F and 1:1 scale) there are cancellations that severely limit the precision of the output. The solution is obviously not to do the scale/unscale operation in the first place but this is coded deep in geo_to_xy. Solution is to introduce a gmt_to_xy_noshift for mapproject and grdproject so we can avoid the cancellations.

Associated revisions

Revision 14300
Added by Paul about 2 years ago

Address issue #708

History

#1 Updated by Paul about 2 years ago

  • Status changed from New to Resolved

Fixed in mapproject in r14300 along the lines discussed above. Given t.txt:

3.05625    43
3.06125    43.006611

Before the fix these coordinates gave identical x,y due to subtraction then addition of two very large numbers:

gmt mapproject -Jl3.0/46.5/44.0/49.0/1:1 -Rg -F -S -C700000/6600000 t.txt
704993.84320000    6211312.53760000    
704993.84320000    6211312.53760000    

After the fix we get:

gmt mapproject -Jl3.0/46.5/44.0/49.0/1:1 -Rg -F -S -C700000/6600000 t.txt
704590.97418418    6211189.56123913    
704724.47545520    6211557.25214706    

Thanks to Romain for pointing out the problem in http://gmt.soest.hawaii.edu/boards/1/topics/2099. The problem only affects mapproject -C commands.

#2 Updated by Paul about 2 years ago

  • Status changed from Resolved to Closed

Closing this as fixed.

Also available in: Atom PDF