Xevi,
Can you provide the package in OpenJUMP that contains the code you
speak of? After Martin figures out what is going on I'd like to
refactor the OpenJUMP code to use the Geometry.union method.
Thanks,
The Sunburned Surveyor
On Mon, Apr 12, 2010 at 9:12 AM, Martin Davis <mbdavis@...> wrote:
> Xavier,
>
> The recommended approach to union sets of lines together is now to use
> the Geometry.union() method. (This wasn't available when the OJ code
> was written). This also has the side effect of noding the linestrings
> together.
>
> It's puzzling that you're seeing a difference in the results of
> union(Point) and union(). They are actually doing exactly the same
> thing under the covers! Is it possible for you to provide a test case
> which shows this behaviour?
>
> Xavier Naval wrote:
>> Hello,
>>
>> Looking at the OpenJUMP code, I have seen that to perform a line
>> cleaning before a polygonize, the method used is to extract a point
>> from the lineset to be cleaned and then use the
>> Geometry.union(Geometry) function.
>> For example this is the code from IntersectGeometries
>>
>> public static Collection nodeLines(Collection lines)
>> {
>> GeometryFactory fact = new GeometryFactory();
>> Geometry linesGeom =
>> fact.createMultiLineString(fact.toLineStringArray(lines));
>>
>> Geometry unionInput = fact.createMultiLineString(null);
>> // force the unionInput to be non-empty if possible, to ensure union
>> is not optimized away
>> Geometry point = extractPoint(lines);
>> if (point != null)
>> unionInput = point;
>>
>> Geometry noded = linesGeom.union(unionInput);
>> List nodedList = new ArrayList();
>> nodedList.add(noded);
>> return nodedList;
>> }
>>
>> But the Geometry class has the method "union" without parameters which
>> seems to be the choice to do the line cleaning (at least I think that
>> this is what the documentation says).
>>
>> After some testing I have found that the method used in OpenJUMP
>> produces better results. Using the lines resulting from the union
>> without parameters to do a polygonize some times returns a
>> TopologyException and this does not happen if the method used is the
>> union(Geometry).
>>
>> Are there any tips or conditions that have to be known before use the
>> union method correctly ?
>>
>> Xevi.
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Jts-topo-suite-user mailing list
>> Jts-topo-suite-user@...
>> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>>
>>
>
> --
> Martin Davis
> Senior Technical Architect
> Refractions Research, Inc.
> (250) 383-3022
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Jts-topo-suite-user mailing list
> Jts-topo-suite-user@...
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>
|