1g.proj(1) GRASS GIS User's Manual g.proj(1)
2
3
4
6 g.proj - Prints or modifies GRASS projection information files (in
7 various co-ordinate system descriptions).
8 Can also be used to create new GRASS locations.
9
11 general, projection, create location
12
14 g.proj
15 g.proj --help
16 g.proj [-pgdjfwetc] [georef=file] [wkt=file] [srid=params]
17 [proj4=params] [epsg=code] [list_codes=string] [datum=name]
18 [datum_trans=index] [location=name] [--help] [--verbose]
19 [--quiet] [--ui]
20
21 Flags:
22 -p
23 Print projection information in conventional GRASS format
24
25 -g
26 Print projection information in shell script style
27
28 -d
29 Verify datum information and print transformation parameters
30
31 -j
32 Print projection information in PROJ.4 format
33
34 -f
35 Print ’flat’ output with no linebreaks (applies to WKT and PROJ.4
36 output)
37
38 -w
39 Print projection information in WKT format
40
41 -e
42 Use ESRI-style format (applies to WKT output only)
43
44 -t
45 Force override of datum transformation information in input co-or‐
46 dinate system
47
48 -c
49 Modify current location projection files
50
51 --help
52 Print usage summary
53
54 --verbose
55 Verbose module output
56
57 --quiet
58 Quiet module output
59
60 --ui
61 Force launching GUI dialog
62
63 Parameters:
64 georef=file
65 Name of georeferenced data file to read projection information from
66
67 wkt=file
68 Name of ASCII file containing a WKT projection description
69 ’-’ for standard input
70
71 srid=params
72 Spatial reference ID with authority name and code
73 E.g. EPSG:4326 or urn:ogc:def:crs:EPSG::4326
74
75 proj4=params
76 PROJ.4 projection description
77 ’-’ for standard input
78
79 epsg=code
80 EPSG projection code
81 Options: 1-1000000
82
83 list_codes=string
84 List codes for given authority, e.g. EPSG, and exit
85 Options: EPSG, ESRI, IAU_2015, IGNF, NKG, OGC, PROJ
86
87 datum=name
88 Datum (overrides any datum specified in input co-ordinate system)
89 Accepts standard GRASS datum codes, or "list" to list and exit
90
91 datum_trans=index
92 Index number of datum transform parameters
93 "0" for unspecified or "-1" to list and exit
94 Options: -1-100
95 Default: 0
96
97 location=name
98 Name of new location to create
99
101 g.proj provides a means of converting a co-ordinate system description
102 (i.e. projection information) between various formats.
103
104 For an introduction to map projections (with PROJ),see the manual page
105 of r.proj.
106
107 If compiled without OGR present, the functionality is limited to:
108
109 • Reporting the projection information for the current location,
110 either in conventional GRASS (-p flag) or PROJ (-j flag) format
111
112 • Changing the datum, or reporting and modifying the datum trans‐
113 formation parameters, for the current location
114
115 When compiled with OGR, functionality is increased and allows output of
116 the projection information in the Well-Known Text (WKT) format popu‐
117 larised by proprietary GIS. In addition, if one of the parameters geo‐
118 ref, wkt, proj4 or epsg is specified, rather than the projection infor‐
119 mation being read from the current location it is imported from an ex‐
120 ternal source as follows:
121
122 georef=filename
123 g.proj attempts to invoke GDAL and OGR in turn to read a georefer‐
124 enced file filename. The projection information will be read from
125 this file. If the file is not georeferenced or cannot be read, XY
126 (unprojected) will be used.
127
128 wkt=filename or -
129 The file filename should contain a projection description in WKT
130 format with or without line-breaks (e.g. a ’.prj’ file). If - is
131 given for the filename, the WKT description will be read from stdin
132 rather than a file.
133
134 proj4=description or -
135 description should be a projection description in PROJ format, en‐
136 closed in quotation marks if there are any spaces. If - is given
137 for description, the PROJ description will be read from stdin
138 rather than as a directly-supplied command-line parameter.
139
140 epsg=number
141 number should correspond to the index number of a valid co-ordinate
142 system in the EPSG database. EPSG code support is based upon a lo‐
143 cal copy of the GDAL CSV co-ordinate system and datum information
144 files, stored in the directory $GISBASE/etc/proj/ogr_csv. These can
145 be updated if necessary to support future revisions of the EPSG
146 database.
147
148 If datum information is incorrect or missing in the input co-ordinate
149 system definition (e.g. PROJ descriptions have very limited support for
150 specifying datum names), a GRASS datum abbreviation can instead be sup‐
151 plied using the datum parameter. This will override any datum contained
152 in the input co-ordinate system, and discard any datum transformation
153 parameters. Enter datum=list to return a list of all the datums sup‐
154 ported by GRASS. Since any existing datum transformation parameters
155 will have been discarded, the datumtrans parameter should in general
156 always be used in conjunction with datum.
157
158 The -p, -j, -w, etc. flags are all functional when importing projection
159 information from an external source, meaning that g.proj can be used to
160 convert between representations of the information. It is not required
161 that either the input or output be in GRASS format.
162
163 In addition however, if the -c flag is specified, g.proj will create
164 new GRASS projection files (PROJ_INFO, PROJ_UNITS, WIND and DE‐
165 FAULT_WIND) based on the imported information. If the location parame‐
166 ter is specified in addition to -c, then a new location will be cre‐
167 ated. Otherwise the projection information files in the current loca‐
168 tion will be overwritten. The program will not warn before doing this.
169
170 The final mode of operation of g.proj is to report on the datum infor‐
171 mation and datum transformation parameters associated with the co-ordi‐
172 nate system. The -d flag will report a human-readable summary of this.
173
175 If the input co-ordinate system contains a datum name but no transfor‐
176 mation parameters, and there is more than one suitable parameter set
177 available (according to the files datum.table and datumtransform.table
178 in $GISBASE/etc/proj), g.proj will check the value of the datumtrans
179 option and act according to the following:
180 -1: List available parameter sets in a GUI-parsable (but also hu‐
181 man-readable) format and exit.
182 0 (default): Continue without specifying parameters - if used when cre‐
183 ating a location, other GRASS modules will use the "default" (likely
184 non-optimum) parameters for this datum if necessary in the future.
185 Any other number less than or equal to the number of parameter sets
186 available for this datum: Choose this parameter set and add it to the
187 co-ordinate system description.
188 If the -t flag is specified, the module will attempt to change the da‐
189 tum transformation parameters using one of the above two methods even
190 if a valid parameter set is already specified in the input co-ordinate
191 system. This can be useful to change the datum information for an ex‐
192 isting location.
193
194 Output is simply based on the input projection information. g.proj does
195 not attempt to verify that the co-ordinate system thus described
196 matches an existing system in use in the world. In particular, this
197 means there are no EPSG Authority codes in the WKT output.
198
199 WKT format shows the false eastings and northings in the projected unit
200 (e.g. meters, feet) but in PROJ format it should always be given in me‐
201 ters.
202
203 The maximum size of input WKT or PROJ projection descriptions is lim‐
204 ited to 8000 bytes.
205
207 Print information
208 Print the projection information for the current location:
209 g.proj -p
210
211 List the possible datum transformation parameters for the current loca‐
212 tion:
213 g.proj -t datumtrans=-1
214
215 Create projection (PRJ) file
216 Create a ’.prj’ file in ESRI format corresponding to the current loca‐
217 tion:
218 g.proj -wef > irish_grid.prj
219
220 Read projection from file
221 Read the projection information from a GeoTIFF file and print it in
222 PROJ format:
223 g.proj -jf georef=ASTER_DEM20020508161837.tif
224
225 Convert the PROJ projection description contained in a text file to WKT
226 format:
227 cat proj4.description | g.proj -w proj4=-
228
229 Create new location
230 Create a new location with the co-ordinate system referred to by EPSG
231 code 4326 (Latitude-Longitude/WGS84), without explicitly specifying da‐
232 tum transformation parameters:
233 g.proj -c epsg=4326 location=latlong
234
235 Create a new location with the co-ordinate system referred to by
236 ESRI-EPSG code 900913 (Google Mercator Projection)
237 g.proj -c epsg=900913 location=google
238
239 Create a new location with the co-ordinate system referred to by EPSG
240 code 29900 (Irish Grid), selecting datum transformation parameter set
241 no. 2:
242 # list available datums for EPSG code 29900
243 g.proj -t datumtrans=-1 epsg=29900
244 g.proj -c epsg=29900 datumtrans=2 location=irish_grid
245
246 Create a new location with the same co-ordinate system as the current
247 location, but forcing a change to datum transformation parameter set
248 no. 1:
249 g.proj -c location=newloc -t datumtrans=1
250
251 Create a new location with the co-ordinate system from a WKT definition
252 stored in a text file:
253 g.proj -c wkt=irish_grid.prj location=irish_grid
254
255 Create a new location from a PROJ description, explicitly specifying a
256 datum and using the default datum transformation parameters:
257 g.proj -c location=spain proj4="+proj=utm +zone=30 +ellps=intl" datum=eur50 datumtrans=0
258
259 Using g.proj output for GDAL/OGR tools
260 Reproject external raster map to current GRASS projection (does not al‐
261 ways make sense!) using the GDAL ’gdalwarp’ tool. We recommend to use
262 the ERDAS/Img format and not to use the ESRI style of WKT:
263 # example for 30x30 pixel resolution (enforce with -tr to avoid odd values)
264 gdalwarp -of HFA -tr 30 30 -t_srs "`g.proj -wf`" aster.img aster_tmerc.img
265
266 Reproject external vector map to current GRASS projection using the OGR
267 ’ogr2ogr’ tool:
268 ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
269
271 PROJ: Projection/datum support library
272 GDAL raster library and toolset
273 OGR vector library and toolset
274
275 Further reading
276
277 • ASPRS Grids and Datum
278
279 • MapRef - The Collection of Map Projections and Reference Sys‐
280 tems for Europe
281
282 • Projections Transform List (PROJ)
283
285 m.proj, r.proj, v.proj, r.import, r.in.gdal, v.import, v.in.ogr
286
288 Paul Kelly
289
291 Available at: g.proj source code (history)
292
293 Accessed: Saturday Jan 21 20:38:14 2023
294
295 Main index | General index | Topics index | Keywords index | Graphical
296 index | Full index
297
298 © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
299
300
301
302GRASS 8.2.1 g.proj(1)