[GRASS-user] raster map from coordinates in python

Stefan Blumentrath Stefan.Blumentrath at nina.no
Mon Feb 12 11:41:15 PST 2018

OK, found it!
Reading the manuals more carefully helps:

So, with my StringIO object "result", formated x y z, the following works:

grass.write_command('r.in.xyz', stdin=result.getvalue(), input='-', output=output,
                                         method='mean', separator=' ')

StringIO can be replaced with BytesIO BTW, though I don`t know what difference the two make...

From: grass-user [mailto:grass-user-bounces at lists.osgeo.org] On Behalf Of Stefan Blumentrath
Sent: mandag 12. februar 2018 14.42
To: grass-user grass-user (grass-user at lists.osgeo.org) <grass-user at lists.osgeo.org>
Subject: [GRASS-user] raster map from coordinates in python

Dear all,

I have a numpy array with x,y, z coordinates that I would like to write to a rater map.
When I convert the array to a StringIO-object and feed it to r.in.xyz I get:
OSError: [Errno 7] Argument list too long
I checked the content of the StringIO object and it contains only three columns (separated by space) and rows separated by '\n'...
Any hints on how to accomplish that without writing out stuff to a textfile?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180212/a44db13e/attachment-0001.html>

More information about the grass-user mailing list