[GRASS-dev] Pygrass - Getting pixel infos from a raster map

Hi,

I’m new to Grass and Grass development.

I’m writing a script using pygrass that should interact with areas in a raster map (output of i.segment). The final goal would be to highlight some of them to the user.

But I can’t even figure out how get infos from the different segments or even the raw pixels.

When instantiating a RasterSegment object (https://grass.osgeo.org/grass70/manuals/libpython/pygrass.raster.html#pygrass.raster.RasterSegment) and using the method .get(row, col) it gives me -2147483648 for .get(0,0) and other values for ‘row’ and ‘col’ give 0.

This doesn’t make any sense to me, am I missing something ?

(Note that both .exist() and .is_open() give True on the RasterSegment object)

Any help would be appreciated !

Lucas

Hi,
The class pygrass.raster.RasterSegment is not directly related to the
output created by i.segment.
It is a class to allow random read and write access to very large
raster layers, that do not fit into the main memory.
Please use pygrass.raster.RasterRow[1] from grass7.2 for row-wise
access to raster maps.

Best regards
Soeren

[1] https://grass.osgeo.org/grass70/manuals/libpython/pygrass.raster.html#pygrass.raster.RasterRow

2017-03-14 20:18 GMT+01:00 Lucas lefevre <lucas.lefevre@hotmail.com>:

Hi,

I'm new to Grass and Grass development.

I'm writing a script using pygrass that should interact with areas in a
raster map (output of i.segment). The final goal would be to highlight some
of them to the user.

But I can't even figure out how get infos from the different segments or
even the raw pixels.

When instantiating a RasterSegment object
(https://grass.osgeo.org/grass70/manuals/libpython/pygrass.raster.html#pygrass.raster.RasterSegment)
and using the method .get(row, col) it gives me -2147483648 for .get(0,0)
and other values for 'row' and 'col' give 0.

This doesn't make any sense to me, am I missing something ?

(Note that both .exist() and .is_open() give True on the RasterSegment
object)

Any help would be appreciated !

Lucas

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