[GRASS-user] v.in.ascii error: G_realloc

Maciej Sieczka tutey at o2.pl
Wed Aug 16 10:59:38 EDT 2006


Praktikant/in2 ARP napisa?(a):
>> -----Ursprüngliche Nachricht-----
>> Von: Maciej Sieczka [mailto:tutey at o2.pl]
>> Gesendet am: Montag, 7. August 2006 13:21
>> An: Praktikant/in2 ARP
>> Cc: 'grassuser at grass.itc.it'
>> Betreff: Re: [GRASS-user] v.in.ascii error: G_realloc
>>
>> Praktikant/in2 ARP napisa?(a):
>>
>>> I have about 50 tiles with geodetic points. These geodetic points should
> be
>>> transformed into a Digital terrain model (DTM) by v.surf.rst.
>> Can you patch those 50 tiles points outside Grass?
>>
>> If they are only plain text files, formatted like
>>
>> x1 y1 z1
>> x2 y2 z2
>> x3 y3 z3
>> ...
>>
>> it will be very easy on Unix:
>>
>> cat patch49 >> patch50
>> cat patch48 >> patch50
>> cat patch47 >> patch50
>> ...
>>
>> and so forth till they all are in a one file, the "patch50".
>>
>> Now import that huge patch50 as 3D, not building topology (v.in.ascii -zb).
>>
>> Set the region *manually* to cover the whole vector patch50 ('g.region
>> vect=' will not work with topologyless vector as you know, so you must
>> use 'g.region n= s= e= w= res=' explicitely).
>>
>> Interpoloate dem out of your 3D points (v.surf.rst layer=0).
> 
> Thank you for the help. I've done everything like Maciek suggested. So
> everything is working fine until using v.surf.rst.
> I have one big vector file in Grass with about 11Million points. But when I
> try to interpolate the file
> with v.surf.rst the same error occurs: 
> 
> ERROR: G_realloc: out of memory

I can't help you with v.surf.rst then. But maybe you could try the
nnbathy tool from nn library (if natural neighbor interpolation suits
your needs). It should let you interpolate a huge raster, and requires
only simple x,y,z ASCII input.

1. download nn.tar.gz from http://www.marine.csiro.au/~sakov/
2. tar xzvf nn.tar.gz
3. cd nn
4. ./configure
5. make
6. gcc -o nnbathy nnbathy.c -g -O2 -Wall -pedantic -I. -DNN_SERIAL
libnn.a -lm
7. chmod u+x ./nnbathy

Copy the nnbathy executable to a directory listed in your PATH.

Run it as:

nnbathy -W 0 -P alg=nn -n "$cols"x"$rows" -x "$west" "$east" -y "$north"
"$south" -i your_huge_xyz_input > interpolated_xyz_output

where cols, rows, east etc. are your region settings obtained with
g.region -g.

Now import interpolated_xyz_output directly as a raster with r.in.xyz or
see lines 155-165 of my r.surf.nnbathy (on Grass WIKI) for how to
transform it into Grass ascii raster to be imported with r.in.ascii.

Refer to nnbathy help screen for details.

Let me know if it worked.

Maciek




More information about the grass-user mailing list