Using Polygonizer isn't overkill - it's exactly what the JTS overlay
operations do internally to build polygon topology.
What could be slightly optimized is splitting the linestring into single
segments. The alternative is to node the linestring to produce sections
containing multiple coordinates, and touching only at endpoints. JTS
contains a class to do this - GeometryNoder. However, if it is known that
the lines touch only at existing vertices, this can be done more
efficiently than the general case, by keeping a map of coordinates and
splitting the lines at coordinates which occur more than once.
But it's really only worth doing this if you are very concerned about
performance.
On Sun, May 17, 2015 at 4:01 AM, Jan Tosovsky <[email protected]> wrote:
> Dear All,
>
> imagine coordinations forming '8' - two touching closed rings. What is the
> best way to create multipolygons from them?
>
> I've tried geometryFactory.createPolygon(coordinates), it converts it to
> the
> desired shape, but the result geometry is invalid (and failing in the next
> operations).
>
> Actually, ordering of my coords can be found here
> http://drifted.in/other/jts/polygon_invalid.png
>
> Currently I create separate lineStrings for each couple of subsequent
> coords
> which I pass to the polygonizer. It produces the desired output (multiple
> polygons), but it seems to be an overkill.
>
> Are there better ways?
>
> Thanks, Jan
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Jts-topo-suite-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user