[GRASS-user] Using r.buffer on image with geographic coordinates

Markus Metz markus.metz.giswork at googlemail.com
Fri Apr 8 05:04:48 EDT 2011


On Tue, Apr 5, 2011 at 2:52 PM, Ned Horning <horning at amnh.org> wrote:
> Markus M.
>
> Thanks once again for the advice. I updated to the most recent version
> yesterday and tried v.buffer again but it ran out of memory at around the
> 75% complete mark during the snapping boundaries step. I only have 5.7 GB
> physical memory and 5.7 GB swap available. I tried r.grow and that appears
> to have worked just fine. It took about 10 hours but I'm not in a rush so
> that's fine. I look forward to testing the GRASS 7 version of v.buffer when
> that is working.
>

The GRASS 7 version of v.buffer is now working.

Some preprocessing you can try before buffering:
- clean the vector with v.clean tool=break,rmdupl
- simplify the vector with v.generalize using as threshold buffer
distance * tolerance, in this case 0.0018 * 0.01

To avoid out-of-memory errors, first export GRASS_VECTOR_LOWMEM=1 [1],
buffer lines and areas separately, then patch and clean the two
results
1. v.buffer type=line distance=0.0018 output=buffer1
2. v.buffer type=area distance=0.0018 output=buffer2
3. v.patch input=buffer1,buffer2 output=buffer
4. v.clean input=buffer output=buffer_clean tool=bpol,rmdupl,break,rmdupl

some more cleaning may be necessary

Please let me know if it works, and if not, where it fails.

Markus M

[1] http://grass.osgeo.org/grass70/manuals/html70_user/variables.html#enviro


> All the best,
>
> Ned
>
> On 04/03/2011 09:07 AM, Markus Metz wrote:
>>
>> On Wed, Mar 30, 2011 at 1:52 PM, Ned Horning<horning at amnh.org>  wrote:
>>>
>>> Thanks for the help compiling with v.buffer. I think I'm running the
>>> correct
>>> version now but the function still does not complete properly. I pasted
>>> the
>>> last several lines from the terminal screen below. I have a feeling I ran
>>> out of memory. Any ideas about what I can try next?
>>>
>> Not sure if the "d.vect: free(): invalid" error means that d.vect
>> caused the problem.
>>
>> You could try several things:
>> - update your grass-6.5 to r45873
>> - close the grass gui and other applications not really necessary
>> - now try v.buffer again
>>
>> The process got killed while snapping boundaries which is rather
>> memory demanding. Memory consumption for vector operations like
>> snapping can be substantially reduced in grass 7, but grass 7 still
>> has only the broken version of v.buffer2 (to be fixed).
>>
>> Alternatively you could use r.grow.distance on the rasterized version
>> and set all values larger than the desired buffer distance to NULL
>>
>> Markus M
>>
>>
>>> --
>>> D0/0: sa: 22
>>> D0/0: current: 22
>>> D0/0:   current = 29, last = 30, lcount = 1
>>> D0/0: sa: 28
>>> D0/0: current: 28
>>> D0/0:   current = 29, last = 34, lcount = 1
>>> D0/0: sa: 28
>>> D0/0: current: 28
>>> Building parts of topology...
>>> Building topology for vector map<testBuf>...
>>> Registering primitives...
>>> 1433691 primitives registered
>>> 119731336 vertices registered
>>> Number of nodes: 1433605
>>> Number of primitives: 1433691
>>> Number of points: 0
>>> Number of lines: 0
>>> Number of boundaries: 1433691
>>> Number of centroids: 0
>>> Number of areas: -
>>> Number of isles: -
>>> Snapping boundaries...
>>> Killed
>>> GRASS 6.5.svn (NHD_Test):~>
>>>
>>> GRASS 6.5.svn (NHD_Test):~>  *** glibc detected *** d.vect: free():
>>> invalid
>>> next size (normal): 0x0000000001a77fc0 ***
>>> ======= Backtrace: =========
>>> /lib/libc.so.6(+0x775b6)[0x7f32f1a055b6]
>>> /lib/libc.so.6(cfree+0x73)[0x7f32f1a0be83]
>>>
>>> /usr/local/grass-6.5.svn/lib/libgrass_vect.6.5.svn.so(Vect_destroy_line_struct+0x28)[0x7f32f35be638]
>>> d.vect(plot1+0xb0a)[0x40876a]
>>> d.vect(main+0x1314)[0x4072d4]
>>> /lib/libc.so.6(__libc_start_main+0xfd)[0x7f32f19acc4d]
>>> d.vect[0x403cd9]
>>> ======= Memory map: ========
>>> 00400000-0040c000 r-xp 00000000 08:05 206108
>>> /usr/local/grass-6.5.svn/bin/d.vect
>>> 0060b000-0060c000 r--p 0000b000 08:05 206108
>>> /usr/local/grass-6.5.svn/bin/d.vect
>>> 0060c000-0060d000 rw-p 0000c000 08:05 206108
>>> /usr/local/grass-6.5.svn/bin/d.vect
>>> 01a6a000-01a8b000 rw-p 00000000 00:00 0
>>>  [heap]
>>> 7f32e4000000-7f32e4021000 rw-p 00000000 00:00 0
>>> 7f32e4021000-7f32e8000000 ---p 00000000 00:00 0
>>> 7f32e8b3c000-7f32e8b48000 r-xp 00000000 08:05 531120
>>> /lib/libnss_files-2.11.1.so
>>> 7f32e8b48000-7f32e8d47000 ---p 0000c000 08:05 531120
>>> /lib/libnss_files-2.11.1.so
>>> 7f32e8d47000-7f32e8d48000 r--p 0000b000 08:05 531120
>>> /lib/libnss_files-2.11.1.so
>>> 7f32e8d48000-7f32e8d49000 rw-p 0000c000 08:05 531120
>>> /lib/libnss_files-2.11.1.so
>>> 7f32e8d49000-7f32e8d53000 r-xp 00000000 08:05 531542
>>> /lib/libnss_nis-2.11.1.so
>>> 7f32e8d53000-7f32e8f52000 ---p 0000a000 08:05 531542
>>> /lib/libnss_nis-2.11.1.so
>>> 7f32e8f52000-7f32e8f53000 r--p 00009000 08:05 531542
>>> /lib/libnss_nis-2.11.1.so
>>> 7f32e8f53000-7f32e8f54000 rw-p 0000a000 08:05 531542
>>> /lib/libnss_nis-2.11.1.so
>>> 7f32e8f54000-7f32e8f5c000 r-xp 00000000 08:05 527981
>>> /lib/libnss_compat-2.11.1.so
>>> 7f32e8f5c000-7f32e915b000 ---p 00008000 08:05 527981
>>> /lib/libnss_compat-2.11.1.so
>>> 7f32e915b000-7f32e915c000 r--p 00007000 08:05 527981
>>> /lib/libnss_compat-2.11.1.so
>>> 7f32e915c000-7f32e915d000 rw-p 00008000 08:05 527981
>>> /lib/libnss_compat-2.11.1.so
>>> 7f32e915d000-7f32e9160000 r-xp 00000000 08:05 523508
>>> /lib/libgpg-error.so.0.4.0
>>> 7f32e9160000-7f32e935f000 ---p 00003000 08:05 523508
>>> /lib/libgpg-error.so.0.4.0
>>> 7f32e935f000-7f32e9360000 r--p 00002000 08:05 523508
>>> /lib/libgpg-error.so.0.4.0
>>> 7f32e9360000-7f32e9361000 rw-p 00003000 08:05 523508
>>> /lib/libgpg-error.so.0.4.0
>>> 7f32e9361000-7f32e9371000 r-xp 00000000 08:05 134688
>>> /usr/lib/libtasn1.so.3.1.7
>>> 7f32e9371000-7f32e9570000 ---p 00010000 08:05 134688
>>> /usr/lib/libtasn1.so.3.1.7
>>> 7f32e9570000-7f32e9571000 r--p 0000f000 08:05 134688
>>> /usr/lib/libtasn1.so.3.1.7
>>> 7f32e9571000-7f32e9572000 rw-p 00010000 08:05 134688
>>> /usr/lib/libtasn1.so.3.1.7
>>> 7f32e9572000-7f32e958b000 r-xp 00000000 08:05 134634
>>> /usr/lib/libsasl2.so.2.0.23
>>> 7f32e958b000-7f32e978a000 ---p 00019000 08:05 134634
>>> /usr/lib/libsasl2.so.2.0.23
>>> 7f32e978a000-7f32e978b000 r--p 00018000 08:05 134634
>>> /usr/lib/libsasl2.so.2.0.23
>>> 7f32e978b000-7f32e978c000 rw-p 00019000 08:05 134634
>>> /usr/lib/libsasl2.so.2.0.23
>>> 7f32e978c000-7f32e97a2000 r-xp 00000000 08:05 531562
>>> /lib/libresolv-2.11.1.so
>>> 7f32e97a2000-7f32e99a1000 ---p 00016000 08:05 531562
>>> /lib/libresolv-2.11.1.so
>>> 7f32e99a1000-7f32e99a2000 r--p 00015000 08:05 531562
>>> /lib/libresolv-2.11.1.so
>>> 7f32e99a2000-7f32e99a3000 rw-p 00016000 08:05 531562
>>> /lib/libresolv-2.11.1.so
>>> 7f32e99a3000-7f32e99a5000 rw-p 00000000 00:00 0
>>> 7f32e99a5000-7f32e99a7000 r-xp 00000000 08:05 523515
>>> /lib/libkeyutils-1.2.so
>>> 7f32e99a7000-7f32e9ba6000 ---p 00002000 08:05 523515
>>> /lib/libkeyutils-1.2.so
>>> 7f32e9ba6000-7f32e9ba7000 r--p 00001000 08:05 523515
>>> /lib/libkeyutils-1.2.so
>>> 7f32e9ba7000-7f32e9ba8000 rw-p 00002000 08:05 523515
>>> /lib/libkeyutils-1.2.so
>>> 7f32e9ba8000-7f32e9baf000 r-xp 00000000 08:05 134268
>>> /usr/lib/libkrb5support.so.0.1
>>> 7f32e9baf000-7f32e9dae000 ---p 00007000 08:05 134268
>>> /usr/lib/libkrb5support.so.0.1
>>> 7f32e9dae000-7f32e9daf000 r--p 00006000 08:05 134268
>>> /usr/lib/libkrb5support.so.0.1
>>> 7f32e9daf000-7f32e9db0000 rw-p 00007000 08:05 134268
>>> /usr/lib/libkrb5support.so.0.1
>>> 7f32e9db0000-7f32e9dd4000 r-xp 00000000 08:05 132675
>>> /usr/lib/libk5crypto.so.3.1
>>> 7f32e9dd4000-7f32e9fd4000 ---p 00024000 08:05 132675
>>> /usr/lib/libk5crypto.so.3.1
>>> 7f32e9fd4000-7f32e9fd5000 r--p 00024000 08:05 132675
>>> /usr/lib/libk5crypto.so.3.1
>>> 7f32e9fd5000-7f32e9fd6000 rw-p 00025000 08:05 132675
>>> /usr/lib/libk5crypto.so.3.1
>>> 7f32e9fd6000-7f32e9fed000 r-xp 00000000 08:05 527976
>>> /lib/libnsl-2.11.1.so
>>> 7f32e9fed000-7f32ea1ec000 ---p 00017000 08:05 527976
>>> /lib/libnsl-2.11.1.so
>>> 7f32ea1ec000-7f32ea1ed000 r--p 00016000 08:05 527976
>>> /lib/libnsl-2.11.1.so
>>> 7f32ea1ed000-7f32ea1ee000 rw-p 00017000 08:05 527976
>>> /lib/libnsl-2.11.1.so
>>> 7f32ea1ee000-7f32ea1f0000 rw-p 00000000 00:00 0
>>> 7f32ea1f0000-7f32ea265000 r-xp 00000000 08:05 523504
>>> /lib/libgcrypt.so.11.5.2
>>> 7f32ea265000-7f32ea464000 ---p 00075000 08:05 523504
>>> /lib/libgcrypt.so.11.5.2
>>> 7f32ea464000-7f32ea465000 r--p 00074000 08:05 523504
>>> /lib/libgcrypt.so.11.5.2
>>> 7f32ea465000-7f32ea468000 rw-p 00075000 08:05 523504
>>> /lib/libgcrypt.so.11.5.2
>>> 7f32ea468000-7f32ea504000 r-xp 00000000 08:05 134182
>>> /usr/lib/libgnutls.so.26.14.12
>>> 7f32ea504000-7f32ea703000 ---p 0009c000 08:05 134182
>>> /usr/lib/libgnutls.so.26.14.12
>>> 7f32ea703000-7f32ea709000 r--p 0009b000 08:05 134182
>>> /usr/lib/libgnutls.so.26.14.12
>>> 7f32ea709000-7f32ea70a000 rw-p 000a1000 08:05 134182
>>> /usr/lib/libgnutls.so.26.14.12
>>> 7f32ea70a000-7f32ea717000 r-xp 00000000 08:05 132150
>>> /usr/lib/liblber-2.4.so.2.5.4
>>>
>>>
>>> On 03/29/2011 03:00 AM, Markus Neteler wrote:
>>>>
>>>> On Tue, Mar 29, 2011 at 8:27 AM, Markus Metz
>>>> <markus.metz.giswork at googlemail.com>    wrote:
>>>> ...
>>>>>
>>>>> If you ran make in the v.buffer directory and afterwards configure,
>>>>> make and make install in /usr/local/src/grass6_devel, you would end up
>>>>> with v.buffer2.
>>>>>
>>>>> 1. run configure, make, but not make install in
>>>>> /usr/local/src/grass6_devel
>>>>>
>>>>> 2. run make in the v.buffer directory, watch out for errors to make
>>>>> sure it compiles all right
>>>>>
>>>>> 3. run make install in /usr/local/src/grass6_devel, but not again
>>>>> configure and/or make
>>>>>
>>>>> 4. that should give you the original v.buffer
>>>>
>>>> An alternative: simply modify
>>>>   vector/Makefile
>>>> to point to v.buffer and not v.buffer2...
>>>>
>>>> Markus
>>>>
>
>


More information about the grass-user mailing list