The reason this is happening is that bydefault the DPSimplifier ensures
that the output is always a valid geometry of the same type as the input.
It does this by using the buffer(0) hack to force polygons to be valid.
Unfortunately, in some "figure-8" cases the buffer algorithm "chooses the
wrong part" of the polygon to return.  That's what is happening in this
case.

There are two current options for dealing with this:

- there's a setting on the DPS class to prevent the validity enforcement:
http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/simplify/DouglasPeuckerSimplifier.html#setEnsureValid(boolean).
Of course, this will leave you with an invalid polygon to deal with.
- Use TopologyPreservingSimplifier to avoid the problem

In a future version of JTS it would be nice to handle this kind of problem
more gracefully by using a smarter polygon cleaning algorithm, which would
preserve the most significant portions of the polygon.

On Tue, Dec 2, 2014 at 10:04 PM, Neetish Jethra <[email protected]>
wrote:

> Hi All,
>
> I am trying to simplify a number of polygons using
> DouglasPeuckerSimplifier, and occasionally (5 out of approx 16000 cases)
> find that most of the polygon is thrown away and only the top protruding
> edge is retained. All the cases that I found had protruding edge on the
> top. Using the TopologyPreservingSimplifier seems to work fine - at least
> in the case mentioned in my example.
>
> I am pasting the problem code example below as well as attaching the
> source and screenshots of the generated polygons. I am using the current
> latest version of JTS (1.13).
>
> Is anyone aware of this issue or any workarounds. I have about 16000
> polygons to process and I have identified this issue on only about 5 of
> them (at a given tolerance). I will try using the
> TopologyPreservingSimplifier but not sure if it will uncover any new issues.
>
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to