[GRASS-dev] r.in.gdal: restrict extent of imported data set to current region?

Hi,

for the upcoming GRASS GIS course at the FOSS4G [1] I have processed a
set of Sentinel-2 scenes + a Landsat time series.
Altogether it accumulates to 90GB of compressed GeoTIFFs.
Since that's not very practical for a course, I would like to loop
over all files and cut the extent by the current region.

Any ideas?

Maybe it would be sufficient to pass the xmin, xmax, ymin, ymax on to
the right GDAL function?

thanks
Markus

PS: sure, otherwise via GDAL ...

[1] http://2016.foss4g.org/ws27.html

--
Markus Neteler
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog

Hello Markus,

Ohh, I would so very much like that -r flag in r.in.gdal (https://trac.osgeo.org/grass/ticket/2055)..)…

For the time being, what about:

r.externalr.mapcalc

g.remove

?

or passing the xmin, xmax, ymin, ymax to gdal_translate with -projwin and then r.in.gdal?

Dunno how efficient would that be for such a huge dataset, though… I’d still prefer the -r in r.in.gdal :wink:

cheers,
Vero

···

2016-08-18 13:50 GMT-03:00 Markus Neteler <neteler@osgeo.org>:

Hi,

for the upcoming GRASS GIS course at the FOSS4G [1] I have processed a
set of Sentinel-2 scenes + a Landsat time series.
Altogether it accumulates to 90GB of compressed GeoTIFFs.
Since that’s not very practical for a course, I would like to loop
over all files and cut the extent by the current region.

Any ideas?

Maybe it would be sufficient to pass the xmin, xmax, ymin, ymax on to
the right GDAL function?

thanks
Markus

PS: sure, otherwise via GDAL …

[1] http://2016.foss4g.org/ws27.html


Markus Neteler
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Thu, Aug 18, 2016 at 1:07 PM, Veronica Andreo <veroandreo@gmail.com>
wrote:

Hello Markus,

Ohh, I would so very much like that -r flag in r.in.gdal (
https://trac.osgeo.org/grass/ticket/2055)…

For the time being, what about:

r.external
r.mapcalc
g.remove

?

or passing the xmin, xmax, ymin, ymax to gdal_translate with -projwin and
then r.in.gdal?

I would get the coordinates of the extent of the current region and
pre-process with the gdal_translate command . A simple python script that
gets a list of all image files and extracts to that projwin with
gdal_translate for each one in turn would be fairly quick.

Dunno how efficient would that be for such a huge dataset, though... I'd
still prefer the -r in r.in.gdal :wink:

cheers,
Vero

2016-08-18 13:50 GMT-03:00 Markus Neteler <neteler@osgeo.org>:

Hi,

for the upcoming GRASS GIS course at the FOSS4G [1] I have processed a
set of Sentinel-2 scenes + a Landsat time series.
Altogether it accumulates to 90GB of compressed GeoTIFFs.
Since that's not very practical for a course, I would like to loop
over all files and cut the extent by the current region.

Any ideas?

Maybe it would be sufficient to pass the xmin, xmax, ymin, ymax on to
the right GDAL function?

thanks
Markus

PS: sure, otherwise via GDAL ...

[1] http://2016.foss4g.org/ws27.html

--
Markus Neteler
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the
official policy of the U.S.Fish and Wildlife Service or Dept. of the
Interior. Life is too short for undocumented, proprietary data formats.
As a federal employee, my email may be subject to FOIA request.

Markus Neteler wrote

Hi,

for the upcoming GRASS GIS course at the FOSS4G [1] I have processed a
set of Sentinel-2 scenes + a Landsat time series.
Altogether it accumulates to 90GB of compressed GeoTIFFs.
Since that's not very practical for a course, I would like to loop
over all files and cut the extent by the current region.

Any ideas?

Maybe it would be sufficient to pass the xmin, xmax, ymin, ymax on to
the right GDAL function?

thanks
Markus

PS: sure, otherwise via GDAL ...

[1] http://2016.foss4g.org/ws27.html

what I've used recently quite a lot on the GDAL side of life:

feed gdal_translate with x,y of upper left and x,y of lower right and to get
automagically the raster with the extent of my interest with the same pixel
size of the original input raster and also the same pixel alignment of the
original input raster; without resampling, but with some kind of an off
adjustment of 1-2 pixels more or less regarding the input extent of
interest.

it would be very nice to have such an automagic also in r.in.gdal.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-in-gdal-restrict-extent-of-imported-data-set-to-current-region-tp5281223p5281259.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

On Thu, Aug 18, 2016 at 7:07 PM, Veronica Andreo <veroandreo@gmail.com> wrote:

Hello Markus,

Ohh, I would so very much like that -r flag in r.in.gdal
(https://trac.osgeo.org/grass/ticket/2055)…

For the time being, what about:

r.external
r.mapcalc
g.remove

?

yeah, maybe...

or passing the xmin, xmax, ymin, ymax to gdal_translate with -projwin and
then r.in.gdal?

Like this (I just beautified the page):
https://grass.osgeo.org/grass72/manuals/g.region.html#using-g.region-in-a-shell-in-combination-with-gdal

Dunno how efficient would that be for such a huge dataset, though... I'd
still prefer the -r in r.in.gdal :wink:

me too :slight_smile:

Markus

On 19-08-16 09:56, Markus Neteler wrote:

On Thu, Aug 18, 2016 at 7:07 PM, Veronica Andreo <veroandreo@gmail.com> wrote:

Hello Markus,

Ohh, I would so very much like that -r flag in r.in.gdal
(https://trac.osgeo.org/grass/ticket/2055)…

For the time being, what about:

r.external
r.mapcalc
g.remove

?

yeah, maybe...

or passing the xmin, xmax, ymin, ymax to gdal_translate with -projwin and
then r.in.gdal?

Like this (I just beautified the page):
https://grass.osgeo.org/grass72/manuals/g.region.html#using-g.region-in-a-shell-in-combination-with-gdal

A (very) minor point, I would suggest to avoid using very long complicated names for data layers in examples (like p016r035_7t20020524_z17_nn30.tif in names example). It makes it more difficult to read, and even scare new users ;-). But, nice example otherwise.

Dunno how efficient would that be for such a huge dataset, though... I'd
still prefer the -r in r.in.gdal :wink:

me too :slight_smile:

Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Fri, Aug 19, 2016 at 10:44 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
...

https://grass.osgeo.org/grass72/manuals/g.region.html#using-g.region-in-a-shell-in-combination-with-gdal

A (very) minor point, I would suggest to avoid using very long complicated
names for data layers in examples (like p016r035_7t20020524_z17_nn30.tif in
names example).

... that's a Landsat name...

It makes it more difficult to read, and even scare new users
;-). But, nice example otherwise.

Sure it can be shortened/changed. Just no time today

Markus