comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Plot curved line on a globe projection
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Plot curved line on a globe projection [message #85347 is a reply to message #85346] Sun, 28 July 2013 12:16 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ljs15@fsmail.net writes:

> I want to plot some straight line sections on a gridded globe plot (i.e. a line joining two points with different lat/lon coordinates), but want these lines to follow the curve of the globe.
>
> I did a test (which I thought would work!) using the following code, but it just plots a straight line:
>
> ;Coordinates etc
> latcentre = 30
> loncentre = 0
> angle = 0
>
> ;Plot globe
> set_plot, 'ps'
> !p.font=0
> device, /encap, xsize=6, ysize=6, /inches
> loadct, 0
> map_set, latcentre, loncentre, angle, $
> /orthographic, /isotropic, /grid, /horizon, /noborder
> map_grid, latdel=5, londel=5, glinestyle=0, glinethick=0.5, color=cgcolor('black')
> oplot, [10,30], [30,50], color=cgcolor('black')
> device, /close
>
> Can anyone offer any help? Is there anything simple I'm missing? I've searched online, but only seem to be able to find posts related to contouring on globe plots.

You can use Map_2Points to get the points making up a great circle
route, but there won't be much difference. Here is an example. The green
line is a straight line, the red is equally spaced in distance, and the
blue is equally spaced in longitude.

;Coordinates etc
latcentre = 30
loncentre = 0
angle = 0

;Plot globe
;set_plot, 'ps'
;!p.font=0
;device, /encap, xsize=6, ysize=6, /inches
cgdisplay, 600, 600
loadct, 0
cgmap_set, latcentre, loncentre, angle, limit=[30, 0, 50, 40], $
/orthographic, /isotropic, /horizon, /noborder
cgmap_grid, latdel=5, londel=5, glinestyle=0, glinethick=0.5
cgPlotS, [10,30], [30,50], Color='grn7'; Straight line.
cgPlotS, Map_2Points(10, 30, 30, 50, DPath=1, NPath=50), $
Color='red' ; Evenly spaced in distance
cgPlotS, Map_2Points(10, 30, 30, 50, /RHUMB, NPath=50), $
Color='blue' ; Evenly spaced in longitude.
;device, /close
END

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: UNsharing an IDLgrImage
Next Topic: Increasing the whitespace between plot axes and the label?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:59:45 PDT 2025

Total time taken to generate the page: 0.95620 seconds