Opened 21 years ago

Closed 16 years ago

#348 closed defect (worksforme)

must be owner of location/mapset to access GRASS raster

Reported by: mdoggett@… Owned by: Mateusz Łoskot
Priority: low Milestone: 1.5.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: grass
Cc: neteler@…, warmerdam

Description (last modified by Mateusz Łoskot)

The problem is in file ownership and GRASS location/mapset settings (For the case when a .grassrc5 doesn't exist) GDAL will only access a GRASS dataset when the user OWNS the dataset (or at least the mapset that contains it).

Group or other read permissions don't count, you MUST own the dataset to be able to access it.

e.g. User A owns PERMANENT can access the raster 'dem' with:

gdalinfo /home/mistral/forages/data/grass/us/PERMANENT/cellhd/dem

User B tries it:

gdalinfo /home/mistral/forages/data/grass/us/PERMANENT/cellhd/dem

But gets:

ERROR 4: `/home/mistral/forages/data/grass/us/PERMANENT/cellhd/dem' not recognised as a supported file format.

GDALOpen failed - 4 `/home/mistral/forages/data/grass/prc/PERMANENT/cellhd/dem' 
not recognised as a supported file format.

You can get around this limitation by providing a .grassrc5 file in the user's home directory that points to the location and mapset of the datasets you want to access. So now if user B has a .grassrc5 file with us/PERMANENT as the LOCATION/MAPSET, user B then will be able to access the raster 'dem' using GDAL.

In my way of thinking, since GDAL is read-only for GRASS datasets, why impose the limitation that the user must OWN the data to simply read it?

Also, you shouldn't have to REQUIRE a .grassrc5 file be present in the HOME directory if you want to specify the complete path to the GRASS raster file (makes it more troublesome for a dynamic web app).

Change History (6)

comment:1 by neteler@…, 21 years ago

Frank,

in general: what about changing GDAL/OGR to use Radim's new
GRASS++ library? It supports 5.0 raster and 5.1 vector:

http://mpa.itc.it/radim/grass++/index.html
(MIT License)

An application which already makes use of it, is QGIS:
http://mpa.itc.it/radim/qgis/

Best regards

 Markus Neteler

comment:2 by warmerdam, 21 years ago

Markus,

I skimmed the documentation for the GRASSRaster class in libgrass++, and it
seems to lack lots of the stuff I use like color tables, data type, coordinate
system and so forth.  

It might be practical at some point in the future to port to libgrass++, but
all things considered, I would prefer to continue targetting a version of 
the grass libraries as they are exposed by libgis itself.  One thing I clearly
should do at some point is upgrade my libgrass to 5.1 (aka 5.7?).


comment:3 by warmerdam, 17 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: grass added
Milestone: 1.5.0
Owner: changed from warmerdam to Mateusz Łoskot
Priority: highlow

Mateusz,

I'd appreciate it if you, Markus or someone could test to see if there is still an issue and if some action is required on this very old bug. No big rush ... really a cleanup item.

comment:4 by Mateusz Łoskot, 17 years ago

Description: modified (diff)

comment:5 by Mateusz Łoskot, 16 years ago

Status: newassigned

I tried to reproduce this problem using GDAL SVN and libgrass 1.4.1 but everything seems to work for me.

I used spearfish sample dataset downloaded from GRASS website and two users: mloskot (owner) and pantera.

mloskot@dog:~$ ls -l /home/grassdata/
drwxr-xr-x 4 mloskot mloskot 4096 2007-10-28 09:22 spearfish60

mloskot (owner of dataset) user runs gdalinfo on the dataset without any problem and pantera can do the same:

pantera@dog:~$ /home/mloskot/dev/gdal/_svn/trunk/gdal/apps/gdalinfo /home/grassdata/spearfish60/PERMANENT/cellhd/elevation.dem
GDAL: Auto register /home/mloskot/dev/gdal/_svn/trunk/gdal/lib/gdalplugins/gdal_GRASS.so using GDALRegister_GRASS.
GDAL: GDALOpen(/home/grassdata/spearfish60/PERMANENT/cellhd/elevation.dem) succeeds as GRASS.
Driver: GRASS/GRASS Database Rasters (5.7+)
Files: /home/grassdata/spearfish60/PERMANENT/cellhd/elevation.dem
Size is 633, 466
Coordinate System is `'
Origin = (590010.000000000000000,4928000.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Corner Coordinates:
Upper Left  (  590010.000, 4928000.000) 
Lower Left  (  590010.000, 4914020.000) 
Upper Right (  609000.000, 4928000.000) 
Lower Right (  609000.000, 4914020.000) 
Center      (  599505.000, 4921010.000) 
Band 1 Block=633x1 Type=UInt16, ColorInterp=Palette
  Min=1066.000 Max=1840.000 
  NoData Value=0
  Metadata:
    COLOR_TABLE_RULES_COUNT=5
    COLOR_TABLE_RULE_RGB_0=0.000000e+00 1.000000e+03 255 255 255 0 255 0
    COLOR_TABLE_RULE_RGB_1=1.000000e+03 1.200000e+03 0 255 0 255 255 0
    COLOR_TABLE_RULE_RGB_2=1.200000e+03 1.400000e+03 255 255 0 255 127 0
    COLOR_TABLE_RULE_RGB_3=1.400000e+03 1.600000e+03 255 127 0 191 127 63
    COLOR_TABLE_RULE_RGB_4=1.600000e+03 2.000000e+03 191 127 63 0 0 0
  Color Table (RGB with 1841 entries)
    0: 255,255,255,255
    1: 255,255,255,255
...

comment:6 by warmerdam, 16 years ago

Resolution: worksforme
Status: assignedclosed
Note: See TracTickets for help on using tickets.