[GRASS-user] Pygrass reading raster issue

Lorenzo Bottaccioli lorenzo.bottaccioli at gmail.com
Mon Mar 14 05:45:42 PDT 2016


Hi all,

I'm tring to read a raster map from my grassData.

I'm using this code

    import os
    import grass.script.setup as gsetup
    from grass.pygrass import raster

    gisbase = os.environ['GISBASE']
    gisdbase = os.path.abspath("/home/myuser/grassData")
    location = 'mylocation'
    mapset = 'mymapset'
    gsetup.init(gisbase, gisdbase, location, mapset)

    elev=raster.RasterRow('elevation')
    elev.open()
    for row in elev:
        print row

But I get all values with nan, where is the error?

If I do `elev.info()` I get this result

    elevation@
    rows: 4502
    cols: 5554
    north: 45.0743663458 south: 45.0500262069 nsres:5.40651685671e-06
    east:  7.67457811722 west: 7.6445503225 ewres:5.40651687473e-06
    range: 233.050003052, 310.049987793
    proj: 3

Tnx

Lorenzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160314/531fc2f7/attachment.html>


More information about the grass-user mailing list