[GRASS-user] r.import extent=region ignored

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today’s binary snapshot) and it seems the extent=region parameter of the r.import is just ignored. Tried from GUI, then from command line, first with multi band virtual raster, then with single JPEG2000 file (as in the example below), with and without the -n option. Is it a known bug, or does it work for someone, perhaps in some other version, or with other input formats? I tried to look in trac, but did not see anything. I am aware how I can clip the rasters after import, but it seemed one of the fine new features which would make the daily use a little more comfortable…

Tomas Brunclik

GRASS 7.2.1svn (utm33n):~ > r.import -o input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2 output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 5569000
south: 5543320
west: 531260
east: 570320
nsres: 20
ewres: 20
rows: 1284
cols: 1953
cells: 2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b
+----------------------------------------------------------------------------+
| Map: 20160913_R122.3b Date: Thu Apr 6 20:27:43 2017 |
| Mapset: sentinel2test Login of Creator: tom |
| Location: utm33n |
| DataBase: /home/tom/GISdata/grass |
| Title: |
| Timestamp: none |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: CELL |
| Rows: 5490 |
| Columns: 5490 |
| Total Cells: 30140100 |
| Projection: UTM (zone 33) |
| N: 5600040 S: 5490240 Res: 20 |
| E: 609780 W: 499980 Res: 20 |
| Range of data: min = 1 max = 17010 |
| |
| Data Description: |
| generated by r.in.gdal |
| |
| Comments: |
| r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\ |
| 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\ |
| 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\ |
| _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\ |
| _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\ |
| tput="20160913_R122.3b" memory=300 offset=0 num_digits=0 |
| |
+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >

Hello Thomas,

If the map you are importing has the same projection than the location, then extent parameter is ignored. It is not a bug, but how the module works. It is written in the ‘Notes’ section, I think. The extent parameter works only when map and target location have different reference systems.

Best,
Vero

···

El 6 abr. 2017 8:59 p. m., “Tomáš Brunclík” <brunclik@atlas.cz> escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today’s binary snapshot) and it seems the extent=region parameter of the r.import is just ignored. Tried from GUI, then from command line, first with multi band virtual raster, then with single JPEG2000 file (as in the example below), with and without the -n option. Is it a known bug, or does it work for someone, perhaps in some other version, or with other input formats? I tried to look in trac, but did not see anything. I am aware how I can clip the rasters after import, but it seemed one of the fine new features which would make the daily use a little more comfortable…

Tomas Brunclik

GRASS 7.2.1svn (utm33n):~ > r.import -o input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2 output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 5569000
south: 5543320
west: 531260
east: 570320
nsres: 20
ewres: 20
rows: 1284
cols: 1953
cells: 2507652
GRASS 7.2.1svn (utm33n):~ > [r.info](http://r.info) map=20160913_R122.3b
+----------------------------------------------------------------------------+
| Map: 20160913_R122.3b Date: Thu Apr 6 20:27:43 2017 |
| Mapset: sentinel2test Login of Creator: tom |
| Location: utm33n |
| DataBase: /home/tom/GISdata/grass |
| Title: |
| Timestamp: none |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: CELL |
| Rows: 5490 |
| Columns: 5490 |
| Total Cells: 30140100 |
| Projection: UTM (zone 33) |
| N: 5600040 S: 5490240 Res: 20 |
| E: 609780 W: 499980 Res: 20 |
| Range of data: min = 1 max = 17010 |
| |
| Data Description: |
| generated by r.in.gdal |
| |
| Comments: |
| r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\ |
| 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\ |
| 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\ |
| _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\ |
| _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\ |
| tput="20160913_R122.3b" memory=300 offset=0 num_digits=0 |
| |
+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >


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

Correction: it is mentioned under ‘known issues’… :slight_smile:

Vero

···

El 6 abr. 2017 9:05 p. m., “Veronica Andreo” <veroandreo@gmail.com> escribió:

Hello Thomas,

If the map you are importing has the same projection than the location, then extent parameter is ignored. It is not a bug, but how the module works. It is written in the ‘Notes’ section, I think. The extent parameter works only when map and target location have different reference systems.

Best,
Vero

El 6 abr. 2017 8:59 p. m., “Tomáš Brunclík” <brunclik@atlas.cz> escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today’s binary snapshot) and it seems the extent=region parameter of the r.import is just ignored. Tried from GUI, then from command line, first with multi band virtual raster, then with single JPEG2000 file (as in the example below), with and without the -n option. Is it a known bug, or does it work for someone, perhaps in some other version, or with other input formats? I tried to look in trac, but did not see anything. I am aware how I can clip the rasters after import, but it seemed one of the fine new features which would make the daily use a little more comfortable…

Tomas Brunclik

GRASS 7.2.1svn (utm33n):~ > r.import -o input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2 output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 5569000
south: 5543320
west: 531260
east: 570320
nsres: 20
ewres: 20
rows: 1284
cols: 1953
cells: 2507652
GRASS 7.2.1svn (utm33n):~ > [r.info](http://r.info) map=20160913_R122.3b
+----------------------------------------------------------------------------+
| Map: 20160913_R122.3b Date: Thu Apr 6 20:27:43 2017 |
| Mapset: sentinel2test Login of Creator: tom |
| Location: utm33n |
| DataBase: /home/tom/GISdata/grass |
| Title: |
| Timestamp: none |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: CELL |
| Rows: 5490 |
| Columns: 5490 |
| Total Cells: 30140100 |
| Projection: UTM (zone 33) |
| N: 5600040 S: 5490240 Res: 20 |
| E: 609780 W: 499980 Res: 20 |
| Range of data: min = 1 max = 17010 |
| |
| Data Description: |
| generated by r.in.gdal |
| |
| Comments: |
| r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\ |
| 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\ |
| 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\ |
| _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\ |
| _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\ |
| tput="20160913_R122.3b" memory=300 offset=0 num_digits=0 |
| |
+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >


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

Once this the ticket below is solved, it will be integrated to r.import:
https://trac.osgeo.org/grass/ticket/2055

Best,

Anna

On Thu, Apr 6, 2017 at 3:09 PM, Veronica Andreo <veroandreo@gmail.com> wrote:

Correction: it is mentioned under 'known issues'... :slight_smile:

Vero

El 6 abr. 2017 9:05 p. m., "Veronica Andreo" <veroandreo@gmail.com>
escribió:

Hello Thomas,

If the map you are importing has the same projection than the location, then
extent parameter is ignored. It is not a bug, but how the module works. It
is written in the 'Notes' section, I think. The extent parameter works only
when map and target location have different reference systems.

Best,
Vero

El 6 abr. 2017 8:59 p. m., "Tomáš Brunclík" <brunclik@atlas.cz> escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) and
it seems the extent=region parameter of the r.import is just ignored. Tried
from GUI, then from command line, first with multi band virtual raster, then
with single JPEG2000 file (as in the example below), with and without the -n
option. Is it a known bug, or does it work for someone, perhaps in some
other version, or with other input formats? I tried to look in trac, but did
not see anything. I am aware how I can clip the rasters after import, but it
seemed one of the fine new features which would make the daily use a little
more comfortable...

Tomas Brunclik

GRASS 7.2.1svn (utm33n):~ > r.import -o
input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2
output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 5569000
south: 5543320
west: 531260
east: 570320
nsres: 20
ewres: 20
rows: 1284
cols: 1953
cells: 2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b

+----------------------------------------------------------------------------+
| Map: 20160913_R122.3b Date: Thu Apr 6 20:27:43 2017
|
| Mapset: sentinel2test Login of Creator: tom
|
| Location: utm33n
|
| DataBase: /home/tom/GISdata/grass
|
| Title:
|
| Timestamp: none
|

|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 0
|
| Data Type: CELL
|
| Rows: 5490
|
| Columns: 5490
|
| Total Cells: 30140100
|
| Projection: UTM (zone 33)
|
| N: 5600040 S: 5490240 Res: 20
|
| E: 609780 W: 499980 Res: 20
|
| Range of data: min = 1 max = 17010
|
|
|
| Data Description:
|
| generated by r.in.gdal
|
|
|
| Comments:
|
| r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
|
| 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
|
| 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
|
| _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
|
| _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\
|
| tput="20160913_R122.3b" memory=300 offset=0 num_digits=0
|
|
|

+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >

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

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

Thank you for information, when it is released, it would be exactly what I was missing.
In the meantime, I created simple script tailored for my purposes to import a multiband raster file (I am working with Sentinel level-2 data with .vrt virtual raster created inside the SAFE directory with .jp2 files via gdalbuildvrt tool). It uses r.external, then sets the region using extent of GRASS vector map (I use a vector rectangle delineating my area of interest stored in the PERMANENT mapset) and pixel aligning to the imported raster, then clipping it creating output raster. The imported bands are added to group of the same name as the base name, bands are numbered by suffixes .1 .2 .3.... The script is not able import directory of band rasters, only single multiband file, but it should be easy to enhance it in this way.
For anyone interested, here it is, it can be run through the button to run a user script:
https://www.dropbox.com/s/y80b07yvso1snux/r.clipimport.py?dl=0

Regards,
Tomas B.

Anna Petrášová napsal(a):

Once this the ticket below is solved, it will be integrated to r.import:
https://trac.osgeo.org/grass/ticket/2055

Best,

Anna

On Thu, Apr 6, 2017 at 3:09 PM, Veronica Andreo <veroandreo@gmail.com> wrote:

Correction: it is mentioned under 'known issues'... :slight_smile:

Vero

El 6 abr. 2017 9:05 p. m., "Veronica Andreo" <veroandreo@gmail.com>
escribió:

Hello Thomas,

If the map you are importing has the same projection than the location, then
extent parameter is ignored. It is not a bug, but how the module works. It
is written in the 'Notes' section, I think. The extent parameter works only
when map and target location have different reference systems.

Best,
Vero

El 6 abr. 2017 8:59 p. m., "Tomáš Brunclík" <brunclik@atlas.cz> escribió:

Hello,

Using GRASS 7.2.1svn r70842 (Linux 64bit from today's binary snapshot) and
it seems the extent=region parameter of the r.import is just ignored. Tried
from GUI, then from command line, first with multi band virtual raster, then
with single JPEG2000 file (as in the example below), with and without the -n
option. Is it a known bug, or does it work for someone, perhaps in some
other version, or with other input formats? I tried to look in trac, but did
not see anything. I am aware how I can clip the rasters after import, but it
seemed one of the fine new features which would make the daily use a little
more comfortable...

Tomas Brunclik

GRASS 7.2.1svn (utm33n):~ > r.import -o
input=/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/2016-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T151344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A_USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2
output=20160913_R122.3b extent=region
UPOZORNĚNÍ: Přeskakuje se kontrola kartografického zobrazení.
Proceeding with import of 1 raster bands...
Importing raster map <20160913_R122.3b>...
  100%
GRASS 7.2.1svn (utm33n):~ > g.region -p
projection: 1 (UTM)
zone: 33
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 5569000
south: 5543320
west: 531260
east: 570320
nsres: 20
ewres: 20
rows: 1284
cols: 1953
cells: 2507652
GRASS 7.2.1svn (utm33n):~ > r.info map=20160913_R122.3b

+----------------------------------------------------------------------------+
  | Map: 20160913_R122.3b Date: Thu Apr 6 20:27:43 2017
|
  | Mapset: sentinel2test Login of Creator: tom
|
  | Location: utm33n
|
  | DataBase: /home/tom/GISdata/grass
|
  | Title:
|
  | Timestamp: none
|

|----------------------------------------------------------------------------|
  |
|
  | Type of Map: raster Number of Categories: 0
|
  | Data Type: CELL
|
  | Rows: 5490
|
  | Columns: 5490
|
  | Total Cells: 30140100
|
  | Projection: UTM (zone 33)
|
  | N: 5600040 S: 5490240 Res: 20
|
  | E: 609780 W: 499980 Res: 20
|
  | Range of data: min = 1 max = 17010
|
  |
|
  | Data Description:
|
  | generated by r.in.gdal
|
  |
|
  | Comments:
|
  | r.in.gdal -o -k input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
|
  | 16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
|
  | 1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
|
  | _L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
|
  | _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2" ou\
|
  | tput="20160913_R122.3b" memory=300 offset=0 num_digits=0
|
  |
|

+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >

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

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

Hi,

2017-04-20 14:30 GMT+02:00 Tomáš Brunclík <brunclik@atlas.cz>:

For anyone interested, here it is, it can be run through the button to run a
user script:
https://www.dropbox.com/s/y80b07yvso1snux/r.clipimport.py?dl=0

there is patch which allows limit r.in.gdal to current region, see [1]. Ma

[1] https://trac.osgeo.org/grass/ticket/2055

  | DataBase: /home/tom/GISdata/grass
|
  | Title:
|
  | Timestamp: none
|

|----------------------------------------------------------------------------|
  |
|
  | Type of Map: raster Number of Categories: 0
|
  | Data Type: CELL
|
  | Rows: 5490
|
  | Columns: 5490
|
  | Total Cells: 30140100
|
  | Projection: UTM (zone 33)
|
  | N: 5600040 S: 5490240 Res: 20
|
  | E: 609780 W: 499980 Res: 20
|
  | Range of data: min = 1 max = 17010
|
  |
|
  | Data Description:
|
  | generated by r.in.gdal
|
  |
|
  | Comments:
|
  | r.in.gdal -o -k
input="/home/tom/GISdata/DPZ/Chlorofyl-vzorkovani/20\
|
  |
16-09-13_R122_S2A_samping_09-13/S2A_USER_PRD_MSIL2A_PDMC_20160915T15\
|
  |
1344_R122_V20160913T100022_20160913T100504.SAFE/GRANULE/S2A_USER_MSI\
|
  |
_L2A_TL_SGS__20160913T170505_A006411_T33UWR_N02.04/IMG_DATA/R20m/S2A\
|
  | _USER_MSI_L2A_TL_SGS__20160913T170505_A006411_T33UWR_B04_20m.jp2"
ou\
|
  | tput="20160913_R122.3b" memory=300 offset=0 num_digits=0
|
  |
|

+----------------------------------------------------------------------------+

GRASS 7.2.1svn (utm33n):~ >

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

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

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

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa