Skip to main content
added 1040 characters in body
Source Link
obrl_soil
  • 3.8k
  • 16
  • 35

Your GRASS mapset region settings are at fault (even a temp dir needs to be set up). Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p')) 

edit: (nah, just use `gmeta()` )

or cheat: open your mapset directly in GRASS and run g.region -p. You can do this even with a temp location so long as you don't exit R, you just have to navigate to the correct R temp folder in GRASS's start screen.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'.

edit2: you may find that after this, the location still has no genuine CRS. g.region won't set that, instead you need to run g.proj -t -c georef='raster_image' or similar. The catch is that this has to be done in the PERMANENT mapset and then g.region -d has to be run in all other mapsets.

Suggest you simplify your life by altering your initGRASS call to start in PERMANENT e.g.

rgrass7::initGRASS("/usr/lib/grass70", home = tempdir(), 
                   mapset = 'PERMANENT', override = TRUE)

I've never understood why that isn't default behaviour in GRASS. Anyway, you can then set projection with g.proj. Notably, if you point it at a raster on disk using the georef= parameter (e.g. georef=<filepath> or georef=raster@file@name), you get all your region settings matching the file, not just the projection.

Your GRASS mapset region settings are at fault (even a temp dir needs to be set up). Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p'))

or cheat: open your mapset directly in GRASS and run g.region -p.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'

Your GRASS mapset region settings are at fault (even a temp dir needs to be set up). Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p')) 

edit: (nah, just use `gmeta()` )

or cheat: open your mapset directly in GRASS and run g.region -p. You can do this even with a temp location so long as you don't exit R, you just have to navigate to the correct R temp folder in GRASS's start screen.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'.

edit2: you may find that after this, the location still has no genuine CRS. g.region won't set that, instead you need to run g.proj -t -c georef='raster_image' or similar. The catch is that this has to be done in the PERMANENT mapset and then g.region -d has to be run in all other mapsets.

Suggest you simplify your life by altering your initGRASS call to start in PERMANENT e.g.

rgrass7::initGRASS("/usr/lib/grass70", home = tempdir(), 
                   mapset = 'PERMANENT', override = TRUE)

I've never understood why that isn't default behaviour in GRASS. Anyway, you can then set projection with g.proj. Notably, if you point it at a raster on disk using the georef= parameter (e.g. georef=<filepath> or georef=raster@file@name), you get all your region settings matching the file, not just the projection.

added 37 characters in body
Source Link
obrl_soil
  • 3.8k
  • 16
  • 35

Your GRASS mapset region settings are at fault (even a temp dir needs to be set up). Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p'))

or cheat: open your mapset directly in GRASS and run g.region -p.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'

Your GRASS mapset region settings are at fault. Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p'))

or cheat: open your mapset directly in GRASS and run g.region -p.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'

Your GRASS mapset region settings are at fault (even a temp dir needs to be set up). Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p'))

or cheat: open your mapset directly in GRASS and run g.region -p.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'

Source Link
obrl_soil
  • 3.8k
  • 16
  • 35

Your GRASS mapset region settings are at fault. Try something like

region_check <- capture.output(execGRASS('g.region', flags = c('p'))

or cheat: open your mapset directly in GRASS and run g.region -p.

You will be able to set the region to match the file you imported by e.g. g.region raster=raster_image'