[geos-devel] Re: [GEOS] #383: huge memory cost and crash in buffer

Martin Davis mbdavis at refractions.net
Wed Nov 3 14:05:32 EDT 2010


I just tried the following approach in JTS, and it works fine (and 
reasonably fast)

- Extract all line segments from the boundary of the polygonal geometry P
- Buffer each line segment by the positive buffer amount (i.e. 8665)
- Union the segment buffers (using UnaryUnion for speed) giving geometry U
- Compute P.difference(U)

In the case given the answer is the empty geometry, as expected.  But 
this approach should work for other situations where a non-empty result 
occurs.

On 11/3/2010 9:08 AM, Martin Davis wrote:
> I checked out this case in JTS, and it has the same symptoms.  The 
> problem is due to the combination of:
>
> - a very complex input geometry
> - a large negative buffer distance, which is the most difficult 
> scenario to compute
>
> If you can run Java 64-bit with lots of memory and have time to wait, 
> you might get an answer out. Otherwise I don't see any simple solution 
> to this problem.  (Actually by manual inspection it looks like the 
> buffer output would be the empty geometry for the given buffer 
> distance. But this isn't a general solution, obviously)
>
> Another way that might work is to buffer the linework of the boundary 
> of the geometry using a positive buffer distance, and then subtract 
> (difference) the result from the original polygon.  However, even the 
> boundary of this polygon is complex enough that the boundary buffer 
> will have to be computed piecewise (i.e. on short sections of the 
> boundary) and then merged.
>
> Martin
>
>
> On 11/3/2010 3:32 AM, GEOS wrote:
>> #383: huge memory cost and crash in buffer
>> ------------------------+--------------------------------------------------- 
>>
>>   Reporter:  atubar      |       Owner:  geos-devel@…
>>       Type:  defect      |      Status:  new
>>   Priority:  major       |   Milestone:  3.2.1
>> Component:  Default     |     Version:  3.2.0
>>   Severity:  Unassigned  |    Keywords:
>> ------------------------+--------------------------------------------------- 
>>
>>
>> Comment(by atubar):
>>
>>   We need to do buffer operation in our program. Often the single 
>> geometry
>>   is huge, and the shapefile is big and contain many geometry.
>>   So what's the best way that you can show us?
>>
>>
>>
>> _______________________________________________
>> geos-devel mailing list
>> geos-devel at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/geos-devel
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list