1g.proj(1) Grass User's Manual g.proj(1)
2
3
4
6 g.proj - Converts co-ordinate system descriptions (i.e. projection
7 information) between various formats (including GRASS format). Can also
8 be used to create GRASS locations.
9
11 general
12
14 g.proj
15 g.proj help
16 g.proj [-pdjweftci] [georef=file] [wkt=file] [proj4=params]
17 [epsg=integer] [datumtrans=integer] [location=name] [--verbose]
18 [--quiet]
19
20 Flags:
21 -p
22 Print projection information (in conventional GRASS format)
23
24 -d
25 Verify datum information and print transformation parameters
26
27 -j
28 Print projection information in PROJ.4 format
29
30 -w
31 Print projection information in WKT format
32
33 -e
34 Use ESRI-style format (applies to WKT output only)
35
36 -f
37 Print 'flat' output with no linebreaks (applies to WKT and PROJ.4
38 output)
39
40 -t
41 Force override of datum transformation information in input co-
42 ordinate system
43
44 -c
45 Create new projection files (modifies current location unless
46 'location' option specified)
47
48 -i
49 Enable interactive prompting (for command-line use only)
50
51 --verbose
52 Verbose module output
53
54 --quiet
55 Quiet module output
56
57 Parameters:
58 georef=file
59 Georeferenced data file to read projection information from
60
61 wkt=file
62 ASCII file containing a WKT projection description (- for stdin)
63
64 proj4=params
65 PROJ.4 projection description (- for stdin)
66
67 epsg=integer
68 EPSG projection code
69 Options: 1-1000000
70
71 datumtrans=integer
72 Index number of datum transform parameters, "0" for unspecified or
73 "-1" to list and exit
74 Options: -1-100
75 Default: 0
76
77 location=name
78 Name of new location to create
79
81 g.proj provides a means of converting a co-ordinate system description
82 (i.e. projection information) between various formats. It requires OGR
83 to compile. The basic functionality of the module is to report the pro‐
84 jection information for the current location, either in conventional
85 GRASS (-p flag) or PROJ.4 (-j flag) format.
86
87 Projection information may also be output in the Well-Known Text (WKT)
88 format popularised by proprietary GIS. In addition, if one of the
89 parameters georef, wkt, proj4 or epsg is specified, rather than the
90 projection information being read from the current location it is
91 imported from an external source as follows:
92
93 georef=filename
94 g.proj attempts to invoke GDAL and OGR in turn to read a georefer‐
95 enced file filename. The projection information will be read from
96 this file. If the file is not georeferenced or cannot be read, XY
97 (unprojected) will be used.
98
99 wkt=filename or -
100 The file filename should contain a projection description in WKT
101 format with or without line-breaks (e.g. a '.prj' file). If - is
102 given for the filename, the WKT description will be read from stdin
103 rather than a file.
104
105 proj4=description or -
106 description should be a projection description in PROJ.4 format,
107 enclosed in quotation marks if there are any spaces. If - is given
108 for description, the PROJ.4 description will be read from stdin
109 rather than as a directly-supplied command-line parameter.
110
111 epsg=number
112 number should correspond to the index number of a valid co-ordinate
113 system in the EPSG database. EPSG code support is based upon a
114 local copy of the GDAL CSV co-ordinate system and datum information
115 files, stored in the directory ${GISBASE}/etc/ogr_csv. These can be
116 updated if necessary to support future revisions of the EPSG data‐
117 base.
118
119 The -p, -j, -w, etc. flags are all functional when importing projection
120 information from an external source, meaning that g.proj can be used to
121 convert between representations of the information. It is not required
122 that either the input or output be in GRASS format.
123
124 In addition however, if the -c flag is specified, g.proj will create
125 new GRASS projection files (PROJ_INFO, PROJ_UNITS, WIND and
126 DEFAULT_WIND) based on the imported information. If the location param‐
127 eter is specified in addition to -c, then a new location will be cre‐
128 ated. Otherwise the projection information files in the current loca‐
129 tion will be overwritten. The program will warn before doing this only
130 if command-line interactive mode (-i flag) is selected.
131
132 The final mode of operation of g.proj is to report on the datum infor‐
133 mation and datum transformation parameters associated with the co-ordi‐
134 nate system. The -d flag will report a human-readable summary of this.
135
137 If the input co-ordinate system contains a datum name but no transfor‐
138 mation parameters, and there is more than one suitable parameter set
139 available (according to the files datum.table and datumtransform.table
140 in ${GISBASE}/etc), g.proj will check the value of the datumtrans
141 option and act according to the following:
142 -1: List available parameter sets in a GUI-parsable (but also human-
143 readable) format and exit.
144 0 (default): Continue without specifying parameters - if used when cre‐
145 ating a location, other GRASS modules will use the "default" (likely
146 non-optimum) parameters for this datum if necessary in the future.
147 Any other number less than or equal to the number of parameter sets
148 available for this datum: Choose this parameter set and add it to the
149 co-ordinate system description.
150 If the module is being used from the command-line through an interac‐
151 tive terminal, the -i flag can be specified to enable interactive
152 selection of the parameter set, and the value of datumtrans (if speci‐
153 fied) is ignored.
154 If the -t flag is specified, the module will attempt to change the
155 datum transformation parameters using one of the above two methods even
156 if a valid parameter set is already specified in the input co-ordinate
157 system.
158
159 Output is simply based on the input projection information. g.proj does
160 not attempt to verify that the co-ordinate system thus described
161 matches an existing system in use in the world. In particular, this
162 means there are no EPSG Authority codes in the WKT output.
163
164 WKT format shows the false eastings and northings in the projected unit
165 (e.g. meters, feet) but in PROJ format it should always be given in
166 meters.
167
168 The maximum size of input WKT or PROJ.4 projection descriptions is lim‐
169 ited to 8000 bytes.
170
172 Print the projection information for the current location:
173
174 g.proj -p
175
176
177 Create a '.prj' file in ESRI format corresponding to the current loca‐
178 tion:
179
180 g.proj -wef > irish_grid.prj
181
182
183 Read the projection information from a geotiff file and print it in
184 PROJ.4 format:
185
186 g.proj -jf georef=ASTER_DEM20020508161837.tif
187
188
189 Convert the PROJ.4 projection description contained in a text file to
190 WKT format:
191
192 cat proj4.description | g.proj -w proj4=-
193
194
195 Create a new location with the co-ordinate system referred to by EPSG
196 code 4326 (Latitude-Longitude/WGS84), without explicitly specifiying
197 datum transformation parameters:
198
199 g.proj -c epsg=4326 location=latlong
200
201
202 Create a new location with the co-ordinate system referred to by ESRI-
203 EPSG code 900913 (Google Mercator Projection)
204
205 g.proj -c proj4="+init=epsg:900913" loc=google
206
207
208 Create a new location with the co-ordinate system referred to by EPSG
209 code 29900 (Irish Grid), selecting datum transformation parameter set
210 no. 2:
211
212 g.proj -c epsg=29900 datumtrans=2 location=irish_grid
213
214
215 Create a new location with the same co-ordinate system as the current
216 location:
217
218 g.proj -c location=newloc
219
220
221 Interactively change/update the datum transformation parameters for the
222 current location:
223
224 g.proj -itc
225
226
227 Create a new location with the co-ordinate system from a WKT definition
228 stored in a text file:
229
230 g.proj -c wkt=irish_grid.prj location=irish_grid
231
232
233 Reproject external raster map to current GRASS projection (does not
234 always make sense!) using the GDAL 'gdalwarp' tool. We recommend to
235 use the ERDAS/Img format and not to use the ESRI style of WKT:
236
237 # example for 30x30 pixel resolution (enforce with -tr to avoid odd
238 values)
239 gdalwarp -of HFA -tr 30 30 -t_srs "`g.proj -wf`" aster.img
240 aster_tmerc.img
241
242
243 Reproject external vector map to current GRASS projection using the OGR
244 'ogr2ogr' tool:
245
246 ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polb‐
247 nda_italy_LL.shp
248
249
251 PROJ 4: Projection/datum support library
252 GDAL raster library and toolset
253 OGR vector library and toolset
254
255 Further reading
256
257 ASPRS Grids and Datum
258
259 MapRef - The Collection of Map Projections and Reference
260 Systems for Europe
261
262 Projections Transform List (PROJ4)
263
265 g.setproj
266 r.in.gdal
267 v.in.ogr
268
270 Paul Kelly
271
272 Last changed: $Date: 2008-03-29 09:45:24 +0100 (Sat, 29 Mar 2008) $
273
274 Full index
275
276 © 2003-2008 GRASS Development Team
277
278
279
280GRASS 6.3.0 g.proj(1)