Debian Codegraph @

bin/ascii2ascii_UTM

raw
1 #!/bin/csh -f
2 ### ascii2ascii_UTM -- Use proj to transform doris output phi/lam/hei to utm x,y,h
3 ## ascii 3 column file input to ascii 3 column file output.
4 ### Example script to generate x,y,h
5 ### next call could be ascii2postscript for plotting with GMT
6 ### Bert Kampes, 14-Aug-2003
7 ### $Id: ascii2ascii_UTM,v 1.2 2003/08/14 13:56:28 kampes Exp $
8 ################################################################
9 set PRG = `basename "$0"`
10 set VER = "v1.0 Doris software"
11 set AUT = "bert kampes, (c)1999-2003"
12 echo "$PRG $VER, $AUT"
13 echo " "
14
15
16
17 ### Handle wrong input
18 set WRONG = "0"
19 set WGSFILE = "$1"
20 set ZONE = "$2"
21 set OUTFILE = "$3"
22 if ( $#argv < 3 ) set WRONG = "1"
23 #---------------------------
24 if ( $WRONG == "1" ) then
25 cat << __EOFHD
26
27 USAGE:
28 $PRG ascii3column +zone=utmzone
29
30 This program transforms the WGS84 "longitude latitude height" 3 column
31 ascii file of Doris (created with philamh2ascii) to UTM coordinates
32 using proj. (longitude=lambda, latitude=phi)
33 First use program lonlathei2ascii to create the 3 column ascii input file.
34
35 THe UTM zone needs to be specified as in the example.
36 Alternatively, one could specify +lon_0=-114 for example (see proj manual).
37
38 This script can serve as an example. If you want to have another projection,
39 see the manual of proj and cs2cs how to do this.
40
41 EXAMPLE:
42 $PRG lonlathei.dat +utm_zone=33 xyz_utm.dat
43
44 See also: http://www.remotesensing.org/proj
45
46 __EOFHD
47 exit 1
48 endif
49
50
51
52
53 ### call proj, no datum shift for utm
54 # order is lon lat by default, use -r to change to lat/lon
55 #To convert the wgs84 coordinates lat=52.00 lon=14.00 to utm zone33
56 #x,y coordinates use (zone automatically deterrmined, else e.g., +zone=32):
57 #proj +proj=utm +zone=33 +ellps=WGS84 << EOF
58 #14.0 52.0
59 #EOF
60
61
62
63 ######################################
64 #set INFILE = temp.lonlat.wgs
65 #set OUTFILE = temp.xy.utm
66 #echo "creating $INFILE with awk"
67 #awk '{print $1, $2}' $XYZFILE > $INFILE
68 # above is not necessary, seems proj copies other columns. brilliant.
69 set INFILE = $WGSFILE
70 echo "creating $OUTFILE with proj"
71 proj +proj=utm +ellps=WGS84 $ZONE $INFILE > $OUTFILE
72 #set OUTFILE2 = temp.xyz.utm
73 #echo "creating $OUTFILE2 with paste"
74
75 #paste $OUTFILE `awk '{print $3}' $XYZFILE` > $OUTFILE2
76 #awk '{print $3}' $XYZFILE > $OUTFILE2.tmp
77 #paste $OUTFILE $OUTFILE2.tmp > $OUTFILE2
78 #rm -f $OUTFILE2.tmp
79
80
81 ### now you can offer this xyz file for plotting with GMT!
82 echo " "
83 #echo "Created: $XYZFILE (3 column ascii wgs84 lon lat hei)"
84 echo "Created: $OUTFILE (3 column ascii UTM x y hei)"
85
86
87 ### EOF.
88