Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 5764c67416561ab82b35afcf9c650e17 > files > 573

GMT-doc-4.5.2-1.fc13.noarch.rpm

<!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.28 Mixing UTM and geographic data sets</TITLE>
<META NAME="description" CONTENT="7.28 Mixing UTM and geographic data sets">
<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="node149.html">
<LINK REL="previous" HREF="node147.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node149.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4694"
  HREF="node149.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4688"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4682"
  HREF="node147.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4690"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4692"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4695"
  HREF="node149.html">7.29 Gridding spherical surface</A>
<B> Up:</B> <A NAME="tex2html4689"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4683"
  HREF="node147.html">7.27 Plotting Sandwell/Smith Mercator</A>
 &nbsp; <B>  <A NAME="tex2html4691"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4693"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015280000000000000000"></A>
<A NAME="24141"></A>
<BR>
7.28 Mixing UTM and geographic data sets
</H1>

<P>
Next, we present a similar case: We wish to plot a data set given in UTM coordinates and want it
to be properly registered with overlying geographic data, such as coastlines or data points.  The
mistake many <A NAME="tex2html1470"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> rookies make is to specify the UTM projection with their UTM
data.  However, that data have already been projected and is now in linear meters.  The only
sensible way to plot such data is with a linear projection, yielding a UTM map.  In this step one can
choose to annotate or tick the map in UTM meters as well.  To plot geographic (lon/lat) data on
the same map there are a few things you must consider:

<OL>
<LI>You need to know the lower left and upper right UTM coordinates of your map. Given
	the UTM zone you can use <A NAME="tex2html1471"
  HREF="../man/mapproject.html"><I><B>mapproject</B></I></A><A NAME="25115"></A> to recover the lon/lat of those two points.
	Conversely, if you instead know the lon/lat corners then you need to convert those
	to UTM coordinates.  You now have the ability to specify two domains with the <B>-R</B> setting:
	The linear UTM meter domain when plotting UTM data and the geographic domain (remember to use the
	rectangular variant of <B>-R</B> that ends with the modifier <B>r</B>) when plotting lon/lat data.
</LI>
<LI>Make sure you use the same scale (and not width) with both the linear and UTM projection.
</LI>
</OL>

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 28
#
# Purpose:      Illustrates how to mix UTM data and UTM projection
# GMT progs:    makecpt, grdgradient, grdimage, grdinfo, pscoast, pstext, mapproject
# Unix progs:   rm, cut, grep, $AWK
#
ps=example_28.ps

# Get intensity grid and set up a color table
grdgradient Kilauea.utm.nc -Nt1 -A45 -GKilauea.utm_i.nc
makecpt -Ccopper -T0/1500/100 -Z &gt; Kilauea.cpt
# Save min/max UTM coordinates with enough precision
grdinfo Kilauea.utm.nc --D_FORMAT=%.10g -C &gt; tmp.txt
# Use inverse UTM projection to determine the lon/lat of the lower left and upper right corners
LL=`cut -f2,4 tmp.txt | mapproject -Ju5Q/1:1 -F -C -I --OUTPUT_DEGREE_FORMAT=ddd:mm:ss.x | \
        awk '{printf "%s/%s\n", $1, $2}'`
UR=`cut -f3,5 tmp.txt | mapproject -Ju5Q/1:1 -F -C -I --OUTPUT_DEGREE_FORMAT=ddd:mm:ss.x | \
        awk '{printf "%s/%s\n", $1, $2}'`
# Lay down the UTM topo grid using a 1:17,000 scale
grdimage Kilauea.utm.nc -IKilauea.utm_i.nc -CKilauea.cpt -Jx1:170000 -P -K -B5000g5000WSne \
        -U"Example 28 in Cookbook" --D_FORMAT=%.10g --ANNOT_FONT_SIZE_PRIMARY=9 \
        --GRID_CROSS_SIZE_PRIMARY=0.1i &gt; $ps
# Overlay geographic data and coregister by using correct region and projection with the same scale
pscoast -R$LL/${UR}r -Ju5Q/1:170000 -O -K -Df+ -Slightblue -W0.5p -B5mg5mNE \
        --ANNOT_FONT_SIZE_PRIMARY=12 --PLOT_DEGREE_FORMAT=ddd:mmF &gt;&gt; $ps
psbasemap -R -J -O -K --ANNOT_FONT_SIZE_PRIMARY=9 -Lf155:07:30W/19:15:40N/19:23N/5k+l1:17,000+u \
        --LABEL_FONT_SIZE=10 &gt;&gt; $ps
echo 155:16:20W 19:26:20N 12 0 1 CB KILAUEA | pstext -R -J -O &gt;&gt; $ps
# Clean up

rm -f Kilauea.utm_i.nc Kilauea.cpt tmp.txt .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<P>
Our script illustrates how we would plot a UTM grid of elevations near Kilauea volcano on the Big Island
of Hawaii.  Given we are in UTM zone 5Q, the script determines the geographic coordinates of the
lower left and upper right corner of the UTM grid, then uses that region when overlaying the coastline
and light blue ocean.  We place a scale bar and label Kilauea crater to complete the figure.

<P>

<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_28"></A><A NAME="25123"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.28:</STRONG>
Mixing UTM and geographic data sets requires knowledge of the map region domain in both
UTM and lon/lat coordinates and consistent use of the same map scale.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="420" HEIGHT="346" ALIGN="BOTTOM" BORDER="0"
 SRC="img206.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_28}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
<A NAME="24151"></A>

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4694"
  HREF="node149.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4688"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4682"
  HREF="node147.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4690"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4692"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4695"
  HREF="node149.html">7.29 Gridding spherical surface</A>
<B> Up:</B> <A NAME="tex2html4689"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4683"
  HREF="node147.html">7.27 Plotting Sandwell/Smith Mercator</A>
 &nbsp; <B>  <A NAME="tex2html4691"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4693"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>