<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>7.23 All great-circle paths lead to Rome</TITLE> <META NAME="description" CONTENT="7.23 All great-circle paths lead to Rome"> <META NAME="keywords" CONTENT="GMT_Docs"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="GMT_Docs.css"> <LINK REL="next" HREF="node145.html"> <LINK REL="previous" HREF="node143.html"> <LINK REL="up" HREF="node121.html"> <LINK REL="next" HREF="node145.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html4672" HREF="node145.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4666" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4660" HREF="node143.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4668" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4670" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4673" HREF="node145.html">7.24 Data selection based</A> <B> Up:</B> <A NAME="tex2html4667" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4661" HREF="node143.html">7.22 World-wide seismicity the</A> <B> <A NAME="tex2html4669" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4671" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION0015230000000000000000"></A> <A NAME="sec:example_23"></A><A NAME="24667"></A> <BR> 7.23 All great-circle paths lead to Rome </H1> <P> While motorists recently have started to question the old saying ``all roads lead to Rome'', aircraft pilots have known from the start that only one great-circle path connects the points of departure and arrival<A NAME="tex2html1475" HREF="footnode.html#foot24668"><SUP>7.5</SUP></A>. This provides the inspiration for our next example which uses <A NAME="tex2html1477" HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="25586"></A> to calculate distances from Rome to anywhere on Earth and <A NAME="tex2html1478" HREF="../man/grdcontour.html"><I><B>grdcontour</B></I></A><A NAME="25591"></A> to contour these distances. We pick five cities that we connect to Rome with great circle arcs, and label these cities with their names and distances (in km) from Rome, all laid down on top of a beautiful world map. Note that we specify that contour labels only be placed along the straight map-line connecting Rome to its antipode, and request curved labels that follows the shape of the contours. <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 23 # # Purpose: Plot distances from Rome and draw shortest paths # GMT progs: grdmath, grdcontour, pscoast, psxy, pstext, grdtrack # Unix progs: echo, cat, awk # ps=example_23.ps # Position and name of central point: lon=12.50 lat=41.99 name="Rome" # Calculate distances (km) to all points on a global 1x1 grid grdmath -Rg -I1 $lon $lat SDIST 111.13 MUL = dist.nc # Location info for 5 other cities + label justification cat << END > cities.d 105.87 21.02 HANOI LM 282.95 -12.1 LIMA LM 178.42 -18.13 SUVA LM 237.67 47.58 SEATTLE RM 28.20 -25.75 PRETORIA LM END pscoast -Rg -JH90/9i -Glightgreen -Sblue -U"Example 23 in Cookbook" -A1000 \ -B0g30:."Distances from $name to the World": -K -Dc -Wthinnest > $ps grdcontour dist.nc -A1000+v+ukm+kwhite -Glz-/z+ -S8 -C500 -O -K -J \ -Wathin,white -Wcthinnest,white,- >> $ps # For each of the cities, plot great circle arc to Rome with psxy while read clon clat city; do (echo $lon $lat; echo $clon $clat) | psxy -R -J -O -K -Wthickest/red >> $ps done < cities.d # Plot red squares at cities and plot names: psxy -R -J -O -K -Ss0.2 -Gred -Wthinnest cities.d >> $ps awk '{print $1, $2, 12, 1, 9, $4, $3}' cities.d | pstext -R -J -O -K -Dj0.15/0 -Gred -N >> $ps # Place a yellow star at Rome echo "$lon $lat" | psxy -R -J -O -K -Sa0.2i -Gyellow -Wthin >> $ps # Sample the distance grid at the cities and use the distance in km for labels grdtrack -Gdist.nc cities.d \ | awk '{printf "%s %s 12 0 1 CT %d\n", $1, $2, int($NF+0.5)}' \ | pstext -R -J -O -D0/-0.2i -N -Wwhite,o -C0.02i/0.02i >> $ps # Clean up after ourselves: rm -f cities.d dist.nc .gmt* </PRE> <BR CLEAR="ALL"> <HR> <DIV ALIGN="CENTER"><A NAME="fig:GMT_example_23"></A><A NAME="25597"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.23:</STRONG> All great-circle paths lead to Rome.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="518" HEIGHT="308" ALIGN="BOTTOM" BORDER="0" SRC="img191.png" ALT="\includegraphics[scale=0.5]{scripts/example_23}"></DIV></TD></TR> </TABLE> </DIV> <P> The script produces the plot in Figure <A HREF="#fig:GMT_example_23">7.23</A>; note how interesting the path to Seattle appears in this particular projection (Hammer). We also note that Rome's antipode lies somewhere near the Chatham plateau (antipodes will be revisited in Section <A HREF="node146.html#sec:example_25">7.25</A>). <P> <A NAME="24676"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html4672" HREF="node145.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4666" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4660" HREF="node143.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4668" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4670" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4673" HREF="node145.html">7.24 Data selection based</A> <B> Up:</B> <A NAME="tex2html4667" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4661" HREF="node143.html">7.22 World-wide seismicity the</A> <B> <A NAME="tex2html4669" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4671" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>