On Sunday, 28 July 2013 20:16:49 UTC+1, David Fanning wrote:
> 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.")
Thanks David, that's just what I was after. I was actually wanting to plot a line with a large change in lat/lon, so the difference between a great circle and straight line is noticeable.
On a similar topic, does anyone know of a method which would allow a circle to be plotted on a globe, from a specification of the central lat/lon location and the radius?
I'm currently looking through the coyote routines and online, but if anyone knows off-hand a way of doing it, please let me know!
Thanks,
Liam
|