[GRASS-user] Start in text mode: define new location with proj.4 string

   When I initially imported the DEMs I pointed the GUI location wizard at
the appropriate prj.adf file and applied v.in.ogr to the hdr.adf file. These
were then re-projected to the project's location, patched together into a
mosaic. Since these cover only a very small area of the state I tried to
overlay a vector file on them but found the regions did not match. The analytical area vector files have this region:

g.region -l
north-west corner: long: 122:23:37.862067W lat: 45:21:05.147704N
north-east corner: long: 122:16:26.271907W lat: 45:21:12.056489N
south-east corner: long: 122:16:11.941163W lat: 45:13:30.917967N
south-west corner: long: 122:23:22.563523W lat: 45:13:24.024495N
center longitude: 122:19:54.654969W
center latitude: 45:17:18.09468N
rows: 14238
cols: 9396

while the DEM mosaic has this region:

g.region -l
north-west corner: long: 97:07:59.896358W lat: 40:58:17.24843N
north-east corner: long: 97:01:02.580568W lat: 40:56:42.861876N
south-east corner: long: 97:03:55.617982W lat: 40:49:23.360021N
south-west corner: long: 97:10:52.177034W lat: 40:50:57.54634N
center longitude: 97:05:57.609434W
center latitude: 40:53:50.313005N
rows: 14187
cols: 10210

The latter is not anywhere near the state; it's somewhere much further east
and somewhat south of Oregon. How this came about is immaterial; I'll
re-import and re-project the three DEMs and hope to get them correct this
time.

   Reading the Startup page I do not see a way to apply the proj.4 string to
create a new location on the command line. I know this is an option with the
GUI location wizard but do not see the appropriate '-c' modifier to do this
on the command line. If one of the startup manual options will do this, and
I'm just not seeing it, please point me to it.

Rich

On Mon, 9 Jul 2018, Rich Shepard wrote:

When I initially imported the DEMs I pointed the GUI location wizard at
the appropriate prj.adf file and applied v.in.ogr to the hdr.adf file. These
were then re-projected to the project's location, patched together into a
mosaic. Since these cover only a very small area of the state I tried to
overlay a vector file on them but found the regions did not match. The analytical area vector files have this region:

   Somehow the target location's region shifted to the east. Fixed that and
am now re-projecting all DEMs.

   Using the -gtext startup option to enter the proj.4 strings when importing
them.

Rich

Reading the Startup page I do not see a way to apply the proj.4 string to
create a new location on the command line. I know this is an option with the
GUI location wizard but do not see the appropriate ‘-c’ modifier to do this
on the command line. If one of the startup manual options will do this, and
I’m just not seeing it, please point me to it.

Rich

What you’ve suggested in past posts seems to work fine (point to a shapefile with accompanying *.prj):

grass -c /home/micha/work/BIDR/Ashalim/GIS/analysis_regions.shp test_location
Creating new GRASS GIS location/mapset...
.....
GRASS 7.4.0 (test_location):~ > g.proj -p
-PROJ_INFO-------------------------------------------------
name : Israel_1993_Israeli_TM_Grid
ellps : grs80
proj : tmerc
lat_0 : 31.73439361111111
lon_0 : 35.20451694444445
k : 1.0000067
x_0 : 219529.584
y_0 : 626907.39
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : Meter
units : Meters
meters : 1
GRASS 7.4.0 (test_location):~ >

Unless I’m not understanding the problem.

···
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

On Tue, 10 Jul 2018, Micha Silver wrote:

What you've suggested in past posts seems to work fine (point to a
shapefile with accompanying *.prj):

Unless I'm not understanding the problem.

Micha,

   My reason for writing was having had raster files imported incorrectly.
Using 'gdalinfo -proj4' gave me the proj.4 strings to define their
projection and I wanted to pass those strings on the command line when
starting grass in text mode.

   The approach I took used the '-gtext' startup option to present the GUI
location wizard. There I was able to enter the proj.4 strings and correctly
import the raster files.

Regards,

Rich

* Micha Silver <tsvibar@gmail.com> [2018-07-10 22:34:53 +0300]:

     Reading the Startup page I do not see a way to apply the proj.4 string
    to
    create a new location on the command line. I know this is an option with
    the
    GUI location wizard but do not see the appropriate '-c' modifier to do
    this
    on the command line. If one of the startup manual options will do this,
    and
    I'm just not seeing it, please point me to it.

    Rich

  What you've suggested in past posts seems to work fine (point to a
  shapefile with accompanying *.prj):

  grass -c /home/micha/work/BIDR/Ashalim/GIS/analysis_regions.shp
  test_location
  Creating new GRASS GIS location/mapset...
  .....
  GRASS 7.4.0 (test_location):~ > g.proj -p
  -PROJ_INFO-------------------------------------------------
  name : Israel_1993_Israeli_TM_Grid
  ellps : grs80
  proj : tmerc
  lat_0 : 31.73439361111111
  lon_0 : 35.20451694444445
  k : 1.0000067
  x_0 : 219529.584
  y_0 : 626907.39
  no_defs : defined
  -PROJ_UNITS------------------------------------------------
  unit : Meter
  units : Meters
  meters : 1
  GRASS 7.4.0 (test_location):~ >

  Unless I'm not understanding the problem.

The grass --help does not mention support for "Proj" strings. Only
geo(-referenced)file and EPSG.

Usage:
  grass75 [-h | -help | --help | --h] [-v | --version]
          [-c | -c geofile | -c EPSG:code[:datum_trans]]
          [-e] [-f] [-text | -gtext | -gui] [--config param]
          [[[GISDBASE/]LOCATION_NAME/]MAPSET]
  grass75 [FLAG]... GISDBASE/LOCATION_NAME/MAPSET --exec EXECUTABLE [EPARAM]...
  grass75 -c [geofile | EPSG] --tmp-location --exec EXECUTABLE [EPARAM]...

Nikos

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

The grass --help does not mention support for "Proj" strings. Only
geo(-referenced)file and EPSG.

Nikos,

   Yep. That's why I asked. So, on the infrequent occasions when source data
does not have a useful EPSG code but 'gdalinfo -proj4' provies the string
using the -gtext grass startup option allows that string to be used to
define a new location.

Regards,

Rich

* Rich Shepard <rshepard@appl-ecosys.com> [2018-07-11 05:44:47 -0700]:

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

The grass --help does not mention support for "Proj" strings. Only
geo(-referenced)file and EPSG.

Nikos,

Yep. That's why I asked. So, on the infrequent occasions when source data
does not have a useful EPSG code but 'gdalinfo -proj4' provies the string
using the -gtext grass startup option allows that string to be used to
define a new location.

I see. Maybe we should file an enhancement ticket, to provide this
option through the command line too?

Nikos

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

I see. Maybe we should file an enhancement ticket, to provide this option
through the command line too?

Nikos,

   I don't know how common this is. This project is the first time I've had
DEM source files in ESRI GRID (*.adf) format and this format needs the
proj.4 string if the GUI location wizard is not used. Using the wizard from
the command line with the -gtext option works well, so the only need for a
new command line option is if the import will be handled by a script rather
than manually.

Regards,

Rich

* Rich Shepard <rshepard@appl-ecosys.com> [2018-07-11 08:24:27 -0700]:

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

I see. Maybe we should file an enhancement ticket, to provide this option
through the command line too?

Nikos,

I don't know how common this is. This project is the first time I've had
DEM source files in ESRI GRID (*.adf) format and this format needs the
proj.4 string if the GUI location wizard is not used. Using the wizard from
the command line with the -gtext option works well, so the only need for a
new command line option is if the import will be handled by a script rather
than manually.

By the way, the -gtext option is not relevant. It merely shows the
welcome/logo screen when launching a GRASS GIS session, then jumps back
to the command line.

GRASS GIS remembers which option you used last time. That means, `grass
-gui` will be the "default": next time you execute `grass` it will
launch the GUI.

If you change your mind and do `grass -text`, this will the "default"
for next time you execute `grass`: it will launch only a command line
GRASS GIS session.

If you do `grass -gtext` it will end up with a command line session, not
the GUI.

Please correct me if I am mistaken.
Nikos

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

By the way, the -gtext option is not relevant. It merely shows the
welcome/logo screen when launching a GRASS GIS session, then jumps back
to the command line.

Nikos,

   Not with 7.5svn. When I use '-gtext' I get the location wizard. After I
run through the process it goes away and I am left at the command line.

Regards,

Rich

* Rich Shepard <rshepard@appl-ecosys.com> [2018-07-11 09:24:01 -0700]:

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

By the way, the -gtext option is not relevant. It merely shows the
welcome/logo screen when launching a GRASS GIS session, then jumps back
to the command line.

Nikos,

Not with 7.5svn. When I use '-gtext' I get the location wizard. After I
run through the process it goes away and I am left at the command line.

Thanks. Then, the help's description deserves an update. Currently:

-gtext use text based interface (show welcome screen) and set as default

Nikos

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

Thanks. Then, the help's description deserves an update. Currently:

-gtext use text based interface (show welcome screen) and set as default

Nikos,

   Then I guess an update is due. See attached screenshot. It has part of the
virtual console with the entered command and the resulting location wizard.

Best regards,

Rich

(attachments)

screenshot.png

On Wed, Jul 11, 2018 at 2:44 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

The grass --help does not mention support for “Proj” strings. Only
geo(-referenced)file and EPSG.

Nikos,

Yep. That’s why I asked. So, on the infrequent occasions when source data
does not have a useful EPSG code but ‘gdalinfo -proj4’ provies the string
using the -gtext grass startup option allows that string to be used to
define a new location.

If ‘gdalinfo -proj4’ provides a reasonable string, you can just as well use

  • grass75 -c geofile GISDBASE/LOCATION_NAME/MAPSET

  • the location wizard using this georeferenced data file

  • from within GRASS ‘g.proj georef= location=’

  • from with GRASS r.in.gdal location=

to create a new location. The result will be the same.

Markus M

Regards,

Rich


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Wed, 11 Jul 2018, Markus Metz wrote:

If 'gdalinfo -proj4' provides a reasonable string, you can just as well use

- grass75 -c geofile GISDBASE/LOCATION_NAME/MAPSET
- the location wizard using this georeferenced data file
- from within GRASS 'g.proj georef= location='
- from with GRASS r.in.gdal location=

to create a new location. The result will be the same.

Markus,

   Thank you. I wondered if the 'geofile' meant the proj.4 string. Yes, this
is the way to go rather than adding a redundancy.

Best regards,

Rich

* Rich Shepard <rshepard@appl-ecosys.com> [2018-07-11 09:58:52 -0700]:

On Wed, 11 Jul 2018, Nikos Alexandris wrote:

Thanks. Then, the help's description deserves an update. Currently:

-gtext use text based interface (show welcome screen) and set as default

Nikos,

Then I guess an update is due. See attached screenshot. It has part of the
virtual console with the entered command and the resulting location wizard.

Best regards,

Rich

Sure, I tried it before suggesting to update the help's description.
I think it was not like that. Since I don't use frequently this option,
I didn't notice.

Thanks, Nikos