[postgis-users] negative buffer
Torsten Lange
tlange at gwdg.de
Wed Jan 21 05:10:05 PST 2009
Again thank you, Vincent!
Now I got the idea!
Torsten
>
>>So 3 question remain:
>>What does st_buffer(geom,0) - just optimising the segments of
>>the polygone?
>>
>>
>
>It builds a buffer around a geometry with a radius of 0. Seems to be
>useless, but from the way the buffer is built, it is a method to
>transform a non-valid geometry into a valid one.
>
>
>
>>Before I dropped the constraint it prevented the insert of
>>the buffer geometry because it complained to be violated.
>>Dropping it st_isvalid()however gives TRUE. This is a bit
>>confusing to me. Do I mix something here? And are invalid
>>geometries now likely to produced by postgis functions in
>>some cases due to dropping the geometry check?
>>
>>
>
>The geometry constraints check dimention, SRID and the type of geometry
>inserted, not its validity.
>If you had problems with the constraints, it is probably because the
>negative buffer yields a point or a linestring instead of a polygon. The
>geometry is probably valid, but it is not the right type, thus the
>constraint violation.
>You probably want to discard those geometries with a test on
>st_geometrytype, taking only polygons into account.
>
>Hope this helps.
>Vincent
>
>
>
>>>>I have polygons with sometimes very peculiar shapes
>>>>
>>>>
>>representing the
>>
>>
>>>>distribution limits of specific types of sediments (e.g.
>>>>
>>>>
>>channel-like
>>
>>
>>>>branching, fluvial fans...).
>>>>When I try to create positive and negative buffers of that polygons
>>>>using the combined (st_buffer(st_simply(geom,i)j)-method I succeed
>>>>only in positive direction. In negative direction it very fastly
>>>>violates enforce_geotype_geom-check. When I look on the
>>>>
>>>>
>>last results I
>>
>>
>>>>see, it is related to the channel-like branches.
>>>>Using the buffer-method in ArcGIS it works as expected. Is there a
>>>>clever method getting it work in PostGIS too?
>>>>
>>>>
>>>>
>>>>
>>>As for getting negative buffers to be valid geometries, I
>>>
>>>
>>generally use
>>
>>
>>>the 0-buffer trick as in :
>>>st_buffer(st_buffer(geom, -i), 0). Not 100% sure it will work but it
>>>generally fixes a lot of problems.
>>>
>>>Let us know of the results if you try that with your data.
>>>
>>>Vincent
>>>
>>>
More information about the postgis-users
mailing list