Skip to search.
jts_discussion · JTS Topology Suite

Group Information

  • Members: 216
  • Category: Open Source
  • Founded: Feb 20, 2002
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

  Messages Help
Advanced
Messages 325 - 362 of 620   Oldest  |  < Older  |  Newer >  |  Newest
Messages 325 - 362 of 620   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#325 From: "Martin Davis" <mbdavis@...>
Date: Mon Jun 9, 2003 5:41 pm
Subject: RE: OT messages
mbdavis@...
Send Email Send Email
 
Thanks for the pointers, guys.  I've changed the list so that only members can post - hopefully this will stop the spam. If not, I'll moderate the list.
 
I've also deleted the nasty msgs from the archives.
 
Martin
 

Martin Davis, Senior Technical Architect

Vivid Solutions Inc.

Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5

Phone: (250) 385 6040    Fax: (250) 385 6046

EMail: mbdavis@...  Web: www.vividsolutions.com

-----Original Message-----
From: Chris Faulkner [mailto:chrisf@...]
Sent: Monday, June 02, 2003 8:10 AM
To: jts_discussion@...
Subject: RE: [jts_discussion] OT messages

I think that only members should be able to post. That sounds easy to do and would eliminate most of the spam. 
 

[Chris Faulkner]  -----Original Message-----
From: Dale Lutz [mailto:dal@...]
Sent: 02 June 2003 15:57
To: jts_discussion@...
Subject: RE: [jts_discussion] OT messages

I think that the list owner can either move to make this list moderated (which adds a bit of hassle but can be done), or flick the switch that says that only members can post, and that should cut the volume down.

 

The same thing, but to a lesser extent, is also happening to the dgnlib list too, I just think that the spammers out there have clued into yahoogroups….  We get tons of spam posted to our FME lists, but we’ve long ago moderated them.  Last weekend, there was about 40 spam messages that went to fme@yahoogroups.com, so our moderator got lots of practice …

 

Dale

 

----------------------------------------------------------------------

Dale Lutz              Safe Software Inc.                 dal@...

VP Development         Surrey, BC, CANADA        phone: (604) 501-9985

                       http://www.safe.com         fax: (604) 501-9965

----------------------------------------------------------------------

 

-----Original Message-----
From: Chris Faulkner [mailto:chrisf@...]
Sent: Monday, June 02, 2003 7:17 AM
To: jts_discussion@...
Subject: [jts_discussion] OT messages

 

Why is there so much spam and pron coming through to this group ? I am a member of several other lists and the amount of junk is nothing like as much as we see here. Is there anything that can be done about it ?

Chris


To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

#326 From: "Martin Davis" <mbdavis@...>
Date: Mon Jun 9, 2003 8:45 pm
Subject: RE: Newbie Question: Finding upper left coordinate
mbdavis@...
Send Email Send Email
 
Oops... that should have been "Find the point where p.y - p.x is a *minimum*".

I'm not quite sure what you mean by "ordering comparator".  In JTS Coordinate
implements Comparable, based on the lexicographic ordering of the coordinates. 
(Geometrically this corresponds to finding the lowest, left-most point, in that
order). You can't use this to determine the clockwise ordering of a ring,
however.  There is a function RobustCGAlgorithms.isCCW which will do this for
you.

JTS also has the Geometry.normalize method, which will orient a ring so that it
is CW and starts with the minimum coordinate.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: cgooty [mailto:cgooty@...]
> Sent: Monday, June 09, 2003 1:05 PM
> To: Martin Davis
> Subject: Re: Newbie Question: Finding upper left coordinate
>
>
> Hi Martin,
>
> Thanks for your response.  Did you mean "find the point p where p.y -
> p.x is a maximum?"  If so can you explain how this would work when
> locating the leftmost/northernmost point in the following set (x y
> clockwise)?  [(3 2), (6 3),  (6 0), (0 0)]
>
> My basic need was to find an ordering comparator in JTS that always
> returned points in the same order (.e.g. upper left first and
> clockwise )
>
> Thanks for your time,
> Mark
>
> --- In jts_discussion@..., "Martin Davis"
> <mbdavis@v...> wrote:
> > Find the point where y - x is a maximum.
> >
> > Martin Davis, Senior Technical Architect
> > Vivid Solutions Inc.
> > Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> > Phone: (250) 385 6040    Fax: (250) 385 6046
> > EMail: mbdavis@v...  Web: www.vividsolutions.com
> >
> >
> > > -----Original Message-----
> > > From: cgooty <cgooty@y...> [mailto:cgooty@y...]
> > > Sent: Friday, May 16, 2003 4:34 PM
> > > To: jts_discussion@...
> > > Subject: [jts_discussion] Newbie Question: Finding upper left
> > > coordinate
> > >
> > >
> > > I have a very basic question.  How do I use JTS to find the upper
> > > left coordinate in a 4 point polygon?
> > >
> > > Thanks,
> > > Mark
> > >
> > >
> > > To unsubscribe from this group, send an email to:
> > > jts_discussion-unsubscribe@...
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://ca.yahoo.com/docs/info/tos.html
> > >
> > >
> > >
>
>

#329 From: "Alvaro Zabala" <alvaro_zabala@...>
Date: Wed Jun 11, 2003 7:51 am
Subject: Intersection problem: PolygonBuilder infinite loop
alvaro_zabala2
Send Email Send Email
 
Hi!
Im a new member, and we´re using JTS 1.2  for two months.
I think its a great tool, but Ive found a problem when we try to intersect
two polygons.

I debugged it, and I saw that when I call geometry1.intersection(geometry2),
it crashed at computePoints(DirectedEdge start) method of EdgeRingStar
class.

The problem is that it enter in an infinite loop (de != startDe) is never
true, so it creates objects until it crashes with a java's out of memory
error.

Anyone would be so kind to help me? Thanks in advance!!!!
(sorry for my poor english)

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

#331 From: Paul Ramsey <pramsey@...>
Date: Wed Jun 11, 2003 2:35 pm
Subject: Re: Intersection problem: PolygonBuilder infinite loop
pwramsey3
Send Email Send Email
 
Alvaro,
Step one is to isolate which two geometries caused the infinite loop
problem. Then post the geometries to the list so that others can
replicate your error.
Paul

On Wednesday, June 11, 2003, at 12:51 AM, Alvaro Zabala wrote:

>
>
> Hi!
> Im a new member, and we´re using JTS 1.2  for two months.
> I think its a great tool, but Ive found a problem when we try to
> intersect
> two polygons.
>
> I debugged it, and I saw that when I call
> geometry1.intersection(geometry2),
> it crashed at computePoints(DirectedEdge start) method of EdgeRingStar
> class.
>
> The problem is that it enter in an infinite loop (de != startDe) is
> never
> true, so it creates objects until it crashes with a java's out of
> memory
> error.
>
> Anyone would be so kind to help me? Thanks in advance!!!!
> (sorry for my poor english)
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>
       Paul Ramsey
       Refractions Research
       Email: pramsey@...
       Phone: (250) 885-0632

#332 From: David Blasby <dblasby@...>
Date: Wed Jun 11, 2003 4:10 pm
Subject: Re: Intersection problem: PolygonBuilder infinite loop
dblasby@...
Send Email Send Email
 
>>The problem is that it enter in an infinite loop (de != startDe) is
>>never
>>true

Is the first point of your polygon the same as the last point?

dave

#336 From: "robmeek355" <register@...>
Date: Sun Jun 22, 2003 1:44 pm
Subject: Union of many polygons
robmeek355
Send Email Send Email
 
Hi there,
I'm using JTS to perform unions on groups of 50-70 overlapping
polygons in a java font editing experiment. The polygons themselves
are relatively simple and most of the time JTS works great. I loop
over all the polygons checking for intersections with all of the
other polygons, and keep going till there are no more intersections.
But this is all a bit slow. Is there a quicker/better/correct way?
Can I collect all of the polygons into some kind of collection and
then perform a single clipping operation on that -reducing the 50+
polygons to a single or at least simplified set of shapes in one fell
swoop?
Thanks for any help,
Rob Meek

#337 From: "Martin Davis" <mbdavis@...>
Date: Mon Jun 23, 2003 4:36 pm
Subject: RE: Union of many polygons
mbdavis@...
Send Email Send Email
 
Unfortunately in the current API there is no way to optimize the operation of
"Union of many polygons".  But you're right in suspecting that there *is* a
faster way of doing this.  What's required is a way to compute all intersections
of all polygons at the same time, and then construct the resulting union.  The
code is all basically there inside JTS, it's just not exposed in a way that
allows the user to specify that he wants to do this.

Part of the problem is that the OGC SFS API is really focussed in operations on
pairs of Geometrys, not collections.  Of course, there is the GeometryCollection
class, which could provide this capability if the semantics of spatial
operations were defined appropriately.  There weren't really any semantics
specified for GeometryCollections in the SFS, and there were some tricky issues
in handling GC's robustly, so we didn't pursue implementing the operations over
GCs.  However, if we implemented the obvious union semantics for GCs for the
spatial operations that would allow exposing an optimized "Union of many
polygons" in a clean way.  (You would form a GC of all the polygons and then
union it with the empty geometry.  Under the covers JTS would first union all
the polygons in the GC).

Any feedback on this issue of defining semantics for GCs is welcome.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: robmeek355 [mailto:register@...]
> Sent: Sunday, June 22, 2003 6:44 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Union of many polygons
>
>
> Hi there,
> I'm using JTS to perform unions on groups of 50-70 overlapping
> polygons in a java font editing experiment. The polygons themselves
> are relatively simple and most of the time JTS works great. I loop
> over all the polygons checking for intersections with all of the
> other polygons, and keep going till there are no more intersections.
> But this is all a bit slow. Is there a quicker/better/correct way?
> Can I collect all of the polygons into some kind of collection and
> then perform a single clipping operation on that -reducing the 50+
> polygons to a single or at least simplified set of shapes in one fell
> swoop?
> Thanks for any help,
> Rob Meek
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

#338 From: "robmeek355" <register@...>
Date: Mon Jun 23, 2003 5:06 pm
Subject: Re: Union of many polygons
robmeek355
Send Email Send Email
 
Thanks for the quick and thorough response. Encouraging that it might
be possible, and that the basic code is there in JTS. I'll take a
closer look behind the interface.
Cheers,
Rob Meek

--- In jts_discussion@..., "Martin Davis" <mbdavis@v...>
wrote:
> Unfortunately in the current API there is no way to optimize the
operation of "Union of many polygons".  But you're right in
suspecting that there *is* a faster way of doing this.  What's
required is a way to compute all intersections of all polygons at the
same time, and then construct the resulting union.  The code is all
basically there inside JTS, it's just not exposed in a way that
allows the user to specify that he wants to do this.
>
> Part of the problem is that the OGC SFS API is really focussed in
operations on pairs of Geometrys, not collections.  Of course, there
is the GeometryCollection class, which could provide this capability
if the semantics of spatial operations were defined appropriately.
There weren't really any semantics specified for GeometryCollections
in the SFS, and there were some tricky issues in handling GC's
robustly, so we didn't pursue implementing the operations over GCs.
However, if we implemented the obvious union semantics for GCs for
the spatial operations that would allow exposing an optimized "Union
of many polygons" in a clean way.  (You would form a GC of all the
polygons and then union it with the empty geometry.  Under the covers
JTS would first union all the polygons in the GC).
>
> Any feedback on this issue of defining semantics for GCs is
welcome.
>
> Martin Davis, Senior Technical Architect
> Vivid Solutions Inc.
> Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> Phone: (250) 385 6040    Fax: (250) 385 6046
> EMail: mbdavis@v...  Web: www.vividsolutions.com
>
>
> > -----Original Message-----
> > From: robmeek355 [mailto:register@r...]
> > Sent: Sunday, June 22, 2003 6:44 AM
> > To: jts_discussion@...
> > Subject: [jts_discussion] Union of many polygons
> >
> >
> > Hi there,
> > I'm using JTS to perform unions on groups of 50-70 overlapping
> > polygons in a java font editing experiment. The polygons
themselves
> > are relatively simple and most of the time JTS works great. I
loop
> > over all the polygons checking for intersections with all of the
> > other polygons, and keep going till there are no more
intersections.
> > But this is all a bit slow. Is there a quicker/better/correct
way?
> > Can I collect all of the polygons into some kind of collection
and
> > then perform a single clipping operation on that -reducing the
50+
> > polygons to a single or at least simplified set of shapes in one
fell
> > swoop?
> > Thanks for any help,
> > Rob Meek
> >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://ca.yahoo.com/docs/info/tos.html
> >
> >
> >

#339 From: "Coats, Andy W" <awcoats@...>
Date: Mon Jun 23, 2003 5:08 pm
Subject: RE: Union of many polygons
awcoats
Send Email Send Email
 

I was wanting to a union of multiple polygons in one operation too but decided it was not priority since we do the union of polygon in a batch process and therefore are too concerned about the speed (and I’m still not done getting the JTS 1.3 changes into Geotools.Net)

 

Just for my own interest, am I correct in my understanding, where arg is now of size 2, if this was increased dynamically the existing code would just need to use a loop in the places marked *****

 

I was unsure about the call to computeEdgeIntersections () – would it have to check each arg with each other arg?

 

As to the semantics of the other operations working on a collection – intersection seems fairly straight forward. I’m not sure how useful difference and symmetric difference on a collection is.

 

 

Andrew Coats

 

private void GCUnion()

  {

    // copy points from input Geometries.

    // This ensures that any Point geometries

    // in the input are considered for inclusion in the result set

    copyPoints(0);

    copyPoints(1);

    copyPoints(N); ********

 

 

    // node the input Geometries

    arg[0].computeSelfNodes(li, false);

    arg[1].computeSelfNodes(li, false);

    arg[N].computeSelfNodes(li, false);*********

 

 

    // compute intersections between edges of the two input geometries

    arg[0].computeEdgeIntersections(arg[1], li, true);

 

    List baseSplitEdges = new ArrayList();

    arg[0].computeSplitEdges(baseSplitEdges);

    arg[1].computeSplitEdges(baseSplitEdges);

    arg[N].computeSplitEdges(baseSplitEdges);******

 

    List splitEdges = baseSplitEdges;

    // add the noded edges to this result graph

    insertUniqueEdges(baseSplitEdges);

 

    computeLabelsFromDepths();

    replaceCollapsedEdges();

    graph.addEdges(edgeList);

    computeLabelling();

    labelIncompleteNodes();

 

 

    /**

     * The ordering of building the result Geometries is important.

     * Areas must be built before lines, which must be built before points.

     * This is so that lines which are covered by areas are not included

     * explicitly, and similarly for points.

     */

    findResultAreaEdges(opCode);

    cancelDuplicateResultEdges();

    PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);

    polyBuilder.add(graph);

    resultPolyList = polyBuilder.getPolygons();

 

    LineBuilder lineBuilder = new LineBuilder(this, geomFact, ptLocator);

    resultLineList = lineBuilder.build(opCode);

 

    PointBuilder pointBuilder = new PointBuilder(this, geomFact, ptLocator);

    resultPointList = pointBuilder.build(opCode);

 

    // gather the results from all calculations into a single Geometry for the result set

    resultGeom = computeGeometry(resultPointList, resultLineList, resultPolyList);

  }

 

 


From: Martin Davis [mailto:mbdavis@...]
Sent: Monday, June 23, 2003 12:37 PM
To: jts_discussion@...

 

Unfortunately in the current API there is no way to optimize the operation of "Union of many polygons".  But you're right in suspecting that there *is* a faster way of doing this.  What's required is a way to compute all intersections of all polygons at the same time, and then construct the resulting union.  The code is all basically there inside JTS, it's just not exposed in a way that allows the user to specify that he wants to do this. 

Part of the problem is that the OGC SFS API is really focussed in operations on pairs of Geometrys, not collections.  Of course, there is the GeometryCollection class, which could provide this capability if the semantics of spatial operations were defined appropriately.  There weren't really any semantics specified for GeometryCollections in the SFS, and there were some tricky issues in handling GC's robustly, so we didn't pursue implementing the operations over GCs.  However, if we implemented the obvious union semantics for GCs for the spatial operations that would allow exposing an optimized "Union of many polygons" in a clean way.  (You would form a GC of all the polygons and then union it with the empty geometry.  Under the covers JTS would first union all the polygons in the GC).

Any feedback on this issue of defining semantics for GCs is welcome. 

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: robmeek355 [mailto:register@...]
> Sent: Sunday, June 22, 2003 6:44 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Union of many polygons
>
>
> Hi there,
> I'm using JTS to perform unions on groups of 50-70 overlapping
> polygons in a java font editing experiment. The polygons themselves
> are relatively simple and most of the time JTS works great. I loop
> over all the polygons checking for intersections with all of the
> other polygons, and keep going till there are no more intersections.
> But this is all a bit slow. Is there a quicker/better/correct way?
> Can I collect all of the polygons into some kind of collection and
> then perform a single clipping operation on that -reducing the 50+
> polygons to a single or at least simplified set of shapes in one fell
> swoop?
> Thanks for any help,
> Rob Meek
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>

>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



#340 From: "Martin Davis" <mbdavis@...>
Date: Mon Jun 23, 2003 5:15 pm
Subject: RE: Union of many polygons
mbdavis@...
Send Email Send Email
 
Andy,
 
I haven't thought about this in detail enough to say whether your proposed changes are sufficient to implement union of multiple polygons.  My gut feel is that it will take more than this to implement this correctly.  Also, I think your proposal of simply repeating the computeSelfNodes() won't provide any speed advantage over simply repeating the union() method.  What's needed is a way of presenting all components of the geometry to the intersection finding code at once, so that it can search through all line segments once only.
 

Martin Davis, Senior Technical Architect

Vivid Solutions Inc.

Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5

Phone: (250) 385 6040    Fax: (250) 385 6046

EMail: mbdavis@...  Web: www.vividsolutions.com

-----Original Message-----
From: Coats, Andy W [mailto:awcoats@...]
Sent: Monday, June 23, 2003 10:09 AM
To: jts_discussion@...
Subject: RE: [jts_discussion] Union of many polygons

I was wanting to a union of multiple polygons in one operation too but decided it was not priority since we do the union of polygon in a batch process and therefore are too concerned about the speed (and I’m still not done getting the JTS 1.3 changes into Geotools.Net)

 

Just for my own interest, am I correct in my understanding, where arg is now of size 2, if this was increased dynamically the existing code would just need to use a loop in the places marked *****

 

I was unsure about the call to computeEdgeIntersections () – would it have to check each arg with each other arg?

 

As to the semantics of the other operations working on a collection – intersection seems fairly straight forward. I’m not sure how useful difference and symmetric difference on a collection is.

 

 

Andrew Coats

 

private void GCUnion()

  {

    // copy points from input Geometries.

    // This ensures that any Point geometries

    // in the input are considered for inclusion in the result set

    copyPoints(0);

    copyPoints(1);

    copyPoints(N); ********

 

 

    // node the input Geometries

    arg[0].computeSelfNodes(li, false);

    arg[1].computeSelfNodes(li, false);

    arg[N].computeSelfNodes(li, false);*********

 

 

    // compute intersections between edges of the two input geometries

    arg[0].computeEdgeIntersections(arg[1], li, true);

 

    List baseSplitEdges = new ArrayList();

    arg[0].computeSplitEdges(baseSplitEdges);

    arg[1].computeSplitEdges(baseSplitEdges);

    arg[N].computeSplitEdges(baseSplitEdges);******

 

    List splitEdges = baseSplitEdges;

    // add the noded edges to this result graph

    insertUniqueEdges(baseSplitEdges);

 

    computeLabelsFromDepths();

    replaceCollapsedEdges();

    graph.addEdges(edgeList);

    computeLabelling();

    labelIncompleteNodes();

 

 

    /**

     * The ordering of building the result Geometries is important.

     * Areas must be built before lines, which must be built before points.

     * This is so that lines which are covered by areas are not included

     * explicitly, and similarly for points.

     */

    findResultAreaEdges(opCode);

    cancelDuplicateResultEdges();

    PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);

    polyBuilder.add(graph);

    resultPolyList = polyBuilder.getPolygons();

 

    LineBuilder lineBuilder = new LineBuilder(this, geomFact, ptLocator);

    resultLineList = lineBuilder.build(opCode);

 

    PointBuilder pointBuilder = new PointBuilder(this, geomFact, ptLocator);

    resultPointList = pointBuilder.build(opCode);

 

    // gather the results from all calculations into a single Geometry for the result set

    resultGeom = computeGeometry(resultPointList, resultLineList, resultPolyList);

  }

 

 


From: Martin Davis [mailto:mbdavis@...]
Sent: Monday, June 23, 2003 12:37 PM
To: jts_discussion@...

 

Unfortunately in the current API there is no way to optimize the operation of "Union of many polygons".  But you're right in suspecting that there *is* a faster way of doing this.  What's required is a way to compute all intersections of all polygons at the same time, and then construct the resulting union.  The code is all basically there inside JTS, it's just not exposed in a way that allows the user to specify that he wants to do this. 

Part of the problem is that the OGC SFS API is really focussed in operations on pairs of Geometrys, not collections.  Of course, there is the GeometryCollection class, which could provide this capability if the semantics of spatial operations were defined appropriately.  There weren't really any semantics specified for GeometryCollections in the SFS, and there were some tricky issues in handling GC's robustly, so we didn't pursue implementing the operations over GCs.  However, if we implemented the obvious union semantics for GCs for the spatial operations that would allow exposing an optimized "Union of many polygons" in a clean way.  (You would form a GC of all the polygons and then union it with the empty geometry.  Under the covers JTS would first union all the polygons in the GC).

Any feedback on this issue of defining semantics for GCs is welcome. 

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: robmeek355 [mailto:register@...]
> Sent: Sunday, June 22, 2003 6:44 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Union of many polygons
>
>
> Hi there,
> I'm using JTS to perform unions on groups of 50-70 overlapping
> polygons in a java font editing experiment. The polygons themselves
> are relatively simple and most of the time JTS works great. I loop
> over all the polygons checking for intersections with all of the
> other polygons, and keep going till there are no more intersections.
> But this is all a bit slow. Is there a quicker/better/correct way?
> Can I collect all of the polygons into some kind of collection and
> then perform a single clipping operation on that -reducing the 50+
> polygons to a single or at least simplified set of shapes in one fell
> swoop?
> Thanks for any help,
> Rob Meek
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>

>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

#341 From: tommaso.nolli@...
Date: Mon Jun 23, 2003 8:01 pm
Subject: Tommaso Nolli è assente dall'ufficio.
tom_0002002
Send Email Send Email
 
I will be out of the office starting  23/06/2003 and will not return until
30/06/2003.

Risponderò al messaggio al mio ritorno.

#344 From: "pablogh_2000" <pablogh_2000@...>
Date: Wed Jun 25, 2003 2:20 pm
Subject: locale
pablogh_2000
Send Email Send Email
 
Hi all,

I am using the GeoServer for saving GPS data into a PostGIS Database.
All is installed on a Win2K Server Machine.

My problem comes when GeoServer generates the Insert Sentence. I am
spanish and here a number has a different format: 1.000,50 (So
decimal separator is ',' not '.'). The generate sentence is something
like that:

---------------------------------------------------------------
INSERT INTO gpsdata(ID, name, geom2)
VALUES
('2', 'Adios',
GeometryFrromText('POINT (421128,86 4447909,08)', 23030));
---------------------------------------------------------------

So, it is generated spanish styled.
Why I am writtng here? Because I have seen in the GeoServer source
the following lines:

---------------------------------------------------------------
     /** Well Known Text writer (from JTS). */
     private static WKTWriter geometryWriter = new WKTWriter();

....
....
....

         sql.append("VALUES (");

         Object[] attributes = feature.getAttributes();

         for (int j = 0; j < attributes.length; j++) {
             if (j == geomPos) {
                 String geoText = geometryWriter.write((Geometry)
attributes[j]);
                 sql.append("GeometryFromText('" + geoText + "', " +
srid + ")");
---------------------------------------------------------------


The attribute coordinates are stored as double.

Finally, can someone tell me what can I do to avoid this locale
effect?

Thanks very much in advance.

Regards,

PAblo Ghiglino.

#345 From: Paul Ramsey <pramsey@...>
Date: Wed Jun 25, 2003 2:46 pm
Subject: Re: locale
pwramsey3
Send Email Send Email
 
Probably the quickest fix would be to tell your JVM to stop being so
darned spanish. Is there a startup parameter or property for java to
control the locale? Presumably the default is to read it from a system
setting, but I bet you can override it with a startup parameter.

Longer term, JTS should always write out numbers using the '.',
regardless of locale, otherwise spanish servers will not be able to
understand english data :) i8n is a fascinating field!

Dave, do we have any locale effects in terms of interpretation of
incoming doubles?

pablogh_2000 wrote:
> Hi all,
>
> I am using the GeoServer for saving GPS data into a PostGIS Database.
> All is installed on a Win2K Server Machine.
>
> My problem comes when GeoServer generates the Insert Sentence. I am
> spanish and here a number has a different format: 1.000,50 (So
> decimal separator is ',' not '.'). The generate sentence is something
> like that:
>
> ---------------------------------------------------------------
> INSERT INTO gpsdata(ID, name, geom2)
> VALUES
> ('2', 'Adios',
> GeometryFrromText('POINT (421128,86 4447909,08)', 23030));
> ---------------------------------------------------------------
>
> So, it is generated spanish styled.
> Why I am writtng here? Because I have seen in the GeoServer source
> the following lines:
>
> ---------------------------------------------------------------
>     /** Well Known Text writer (from JTS). */
>     private static WKTWriter geometryWriter = new WKTWriter();
>
> ....
> ....
> ....
>
>         sql.append("VALUES (");
>
>         Object[] attributes = feature.getAttributes();
>
>         for (int j = 0; j < attributes.length; j++) {
>             if (j == geomPos) {
>                 String geoText = geometryWriter.write((Geometry)
> attributes[j]);
>                 sql.append("GeometryFromText('" + geoText + "', " +
> srid + ")");
> ---------------------------------------------------------------
>
>
> The attribute coordinates are stored as double.
>
> Finally, can someone tell me what can I do to avoid this locale
> effect?
>
> Thanks very much in advance.
>
> Regards,
>
> PAblo Ghiglino.
>
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to http://ca.yahoo.com/docs/info/tos.html
>
>


--
        __
       /
       | Paul Ramsey
       | Refractions Research
       | Email: pramsey@...
       | Phone: (250) 885-0632
       \_

#346 From: Aron Olsen <aro@...>
Date: Wed Jun 25, 2003 4:02 pm
Subject: RE: locale
aronolsen
Send Email Send Email
 

Hi there,

 

In my experience changing the locale on a Win2K machine will also change the default locale used by the JVM.

If JTS is always to write "american" numbers, I guess you will need to make use of an explicit NumberFormat in the writer:

 

// Initialize like:

Locale usLocale = new Locale( "en", "US" );

NumberFormat usFormat = NumberFormat.getInstance( usLocale );

 

usFormat.setGroupingUsed( true );               // if to use grouping separators

usFormat.setMaximumFractionDigits( digits );    // to desired precision

 

// and then format numbers using:

String usFormat.format( Number );

 

Just if it's of any help.

Aron

 

 

 

 

-----Original Message-----
From: Paul Ramsey [mailto:pramsey@...]
Sent: 25. juni 2003 15:47
To: jts_discussion@...
Cc: David Blasby
Subject: Re: [jts_discussion] locale

 

Probably the quickest fix would be to tell your JVM to stop being so
darned spanish. Is there a startup parameter or property for java to
control the locale? Presumably the default is to read it from a system
setting, but I bet you can override it with a startup parameter.

Longer term, JTS should always write out numbers using the '.',
regardless of locale, otherwise spanish servers will not be able to
understand english data :) i8n is a fascinating field!

Dave, do we have any locale effects in terms of interpretation of
incoming doubles?

pablogh_2000 wrote:
> Hi all,
>
> I am using the GeoServer for saving GPS data into a PostGIS Database.
> All is installed on a Win2K Server Machine.
>
> My problem comes when GeoServer generates the Insert Sentence. I am
> spanish and here a number has a different format: 1.000,50 (So
> decimal separator is ',' not '.'). The generate sentence is something
> like that:
>
> ---------------------------------------------------------------
> INSERT INTO gpsdata(ID, name, geom2)
> VALUES
> ('2', 'Adios',
> GeometryFrromText('POINT (421128,86 4447909,08)', 23030));
> ---------------------------------------------------------------
>
> So, it is generated spanish styled.
> Why I am writtng here? Because I have seen in the GeoServer source
> the following lines:
>
> ---------------------------------------------------------------
>     /** Well Known Text writer (from JTS). */
>     private static WKTWriter geometryWriter = new WKTWriter();
>
> ....
> ....
> ....
>
>         sql.append("VALUES (");
>
>         Object[] attributes = feature.getAttributes();
>
>         for (int j = 0; j < attributes.length; j++) {
>             if (j == geomPos) {
>                 String geoText = geometryWriter.write((Geometry)
> attributes[j]);
>                 sql.append("GeometryFromText('" + geoText + "', " +
> srid + ")");
> ---------------------------------------------------------------
>
>
> The attribute coordinates are stored as double.
>
> Finally, can someone tell me what can I do to avoid this locale
> effect?
>
> Thanks very much in advance.
>
> Regards,
>
> PAblo Ghiglino.
>
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>

>
> Your use of Yahoo! Groups is subject to http://ca.yahoo.com/docs/info/tos.html
>
>


--
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey@...
      | Phone: (250) 885-0632
      \_


To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



#347 From: David Blasby <dblasby@...>
Date: Wed Jun 25, 2003 4:21 pm
Subject: Re: locale
dblasby@...
Send Email Send Email
 
Paul Ramsey wrote:
> Dave, do we have any locale effects in terms of interpretation of
> incoming doubles?

I dont know - I use atof() and strtod() for the parsing.

The MAN page says these function are defined by the ANSI C
specification.  Its also conforming to SVID 3, POSIX, BSD 4.3, and ISO 9899.

I dont think its local-specific, but it could be...

dave

#348 From: "Martin Davis" <mbdavis@...>
Date: Wed Jun 25, 2003 10:45 pm
Subject: RE: locale
mbdavis@...
Send Email Send Email
 
Thanks for pointing out this problem, Pablo, and thanks for pointing out a solution, Aron.  I'll add this to the list for JTS Version 1.3.1
 

Martin Davis, Senior Technical Architect

Vivid Solutions Inc.

Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5

Phone: (250) 385 6040    Fax: (250) 385 6046

EMail: mbdavis@...  Web: www.vividsolutions.com

-----Original Message-----
From: Aron Olsen [mailto:aro@...]
Sent: Wednesday, June 25, 2003 9:03 AM
To: 'jts_discussion@...'
Subject: RE: [jts_discussion] locale

Hi there,

 

In my experience changing the locale on a Win2K machine will also change the default locale used by the JVM.

If JTS is always to write "american" numbers, I guess you will need to make use of an explicit NumberFormat in the writer:

 

// Initialize like:

Locale usLocale = new Locale( "en", "US" );

NumberFormat usFormat = NumberFormat.getInstance( usLocale );

 

usFormat.setGroupingUsed( true );               // if to use grouping separators

usFormat.setMaximumFractionDigits( digits );    // to desired precision

 

// and then format numbers using:

String usFormat.format( Number );

 

Just if it's of any help.

Aron

 

 

 

 

-----Original Message-----
From: Paul Ramsey [mailto:pramsey@...]
Sent: 25. juni 2003 15:47
To: jts_discussion@...
Cc: David Blasby
Subject: Re: [jts_discussion] locale

 

Probably the quickest fix would be to tell your JVM to stop being so
darned spanish. Is there a startup parameter or property for java to
control the locale? Presumably the default is to read it from a system
setting, but I bet you can override it with a startup parameter.

Longer term, JTS should always write out numbers using the '.',
regardless of locale, otherwise spanish servers will not be able to
understand english data :) i8n is a fascinating field!

Dave, do we have any locale effects in terms of interpretation of
incoming doubles?

pablogh_2000 wrote:
> Hi all,
>
> I am using the GeoServer for saving GPS data into a PostGIS Database.
> All is installed on a Win2K Server Machine.
>
> My problem comes when GeoServer generates the Insert Sentence. I am
> spanish and here a number has a different format: 1.000,50 (So
> decimal separator is ',' not '.'). The generate sentence is something
> like that:
>
> ---------------------------------------------------------------
> INSERT INTO gpsdata(ID, name, geom2)
> VALUES
> ('2', 'Adios',
> GeometryFrromText('POINT (421128,86 4447909,08)', 23030));
> ---------------------------------------------------------------
>
> So, it is generated spanish styled.
> Why I am writtng here? Because I have seen in the GeoServer source
> the following lines:
>
> ---------------------------------------------------------------
>     /** Well Known Text writer (from JTS). */
>     private static WKTWriter geometryWriter = new WKTWriter();
>
> ....
> ....
> ....
>
>         sql.append("VALUES (");
>
>         Object[] attributes = feature.getAttributes();
>
>         for (int j = 0; j < attributes.length; j++) {
>             if (j == geomPos) {
>                 String geoText = geometryWriter.write((Geometry)
> attributes[j]);
>                 sql.append("GeometryFromText('" + geoText + "', " +
> srid + ")");
> ---------------------------------------------------------------
>
>
> The attribute coordinates are stored as double.
>
> Finally, can someone tell me what can I do to avoid this locale
> effect?
>
> Thanks very much in advance.
>
> Regards,
>
> PAblo Ghiglino.
>
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>

>
> Your use of Yahoo! Groups is subject to http://ca.yahoo.com/docs/info/tos.html
>
>


--
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey@...
      | Phone: (250) 885-0632
      \_


To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

#349 From: "Andreas Jaeger" <jaeger@...>
Date: Thu Jun 26, 2003 12:30 pm
Subject: Re: locale
sergeantpluck
Send Email Send Email
 
> Probably the quickest fix would be to tell your JVM to stop being so
> darned spanish. Is there a startup parameter or property for java to
> control the locale? Presumably the default is to read it from a system
> setting, but I bet you can override it with a startup parameter.

You can pass to the JVM the appropriate system properties:
-Duser.country=GB -Duser.language=en

#350 From: "Hisaji Ono" <hi_ono2001@...>
Date: Fri Jun 27, 2003 3:55 pm
Subject: JUMP --- Java Unified Mapping PLatform
hi_ono2001@...
Send Email Send Email
 
Hi.

  Yesterday I knew release of JUMP from an
article(http://www.digitalearth.org/story/2003/6/26/132356/173).

  I tried JUMP(http://www.vividsolutions.com/jump/) using JTS APIs.

  It's very splendid.

  Unfortunatelly, there seemes to be no mailing list.

  Thank you very much for dev. team of Vivid Solutions.

#351 From: "Martin Davis" <mbdavis@...>
Date: Fri Jun 27, 2003 3:58 pm
Subject: RE: JUMP --- Java Unified Mapping PLatform
mbdavis@...
Send Email Send Email
 
Glad you like it, Hisaji.

We're working on the mailing list...

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: Hisaji Ono [mailto:hi_ono2001@...]
> Sent: Friday, June 27, 2003 8:56 AM
> To: jts_discussion@...
> Subject: [jts_discussion] JUMP --- Java Unified Mapping PLatform
>
>
> Hi.
>
>  Yesterday I knew release of JUMP from an
> article(http://www.digitalearth.org/story/2003/6/26/132356/173).
>
>  I tried JUMP(http://www.vividsolutions.com/jump/) using JTS APIs.
>
>  It's very splendid.
>
>  Unfortunatelly, there seemes to be no mailing list.
>
>  Thank you very much for dev. team of Vivid Solutions.
>
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

#352 From: "Martin Davis" <mbdavis@...>
Date: Fri Jun 27, 2003 5:17 pm
Subject: Announcing JUMP and JCS
mbdavis@...
Send Email Send Email
 
JTS'ers:

You may be interested in checking out the following new products from the same
team that brought you JTS:

JUMP - the Unified Mapping Platform

An interactive, highly extensible GUI platform for spatial data visualization
and processing

http://www.vividsolutions.com/jump/

The JCS Conflation Suite

A collection of automated and interactive functions that solve a variety of
spatial data conflation problems.

http://jcs.vividsolutions.com/


Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com

#353 From: Cameron Shorter <cameron@...>
Date: Sun Jun 29, 2003 7:52 pm
Subject: Re: Announcing JUMP and JCS
cameronshorter
Send Email Send Email
 
On Friday 27 Jun 2003 6:17 pm, Martin Davis wrote:
> You may be interested in checking out the following new products from the
> same team that brought you JTS:
>
> JUMP - the Unified Mapping Platform
>
> An interactive, highly extensible GUI platform for spatial data
> visualization and processing
>
> http://www.vividsolutions.com/jump/

For those running on unix platforms, you might want to use the attached shell
startup script (which is a translation of the .bat startup script).  It needs
to be installed in the bin directory.

--
Cameron Shorter              http://shorter.net/cameron
Open Source Developer        http://mapbuilder.sourceforge.net
                              http://geotools.org
Senior Software Engineer     http://www.adi-limited.com/

#354 From: "robmeek355" <register@...>
Date: Mon Jun 30, 2003 11:15 am
Subject: Re: Union of many polygons
robmeek355
Send Email Send Email
 
Hallo again,

I'm still pondering the issue of performing a quicker union of
multiple polygons.

I can see now that the code is already there, at least to calculate
the intersections quickly without having to loop over the Geometries.
For example, having commented out the checkNotGeometryCollection
functions in Geometry.union, a union of a MultiLineString collection
with an empty Geometry runs without complaint, and produces a
collection of correctly chopped LineStrings.

When I run the code with a MultiPolygon however I always get this
TopologyException as the computeLabelling function is called:

com.vividsolutions.jts.geom.TopologyException: side location conflict
[ (76.36317151874525, 101.53496246981595, NaN) ]
  at com/vividsolutions/jts/graph/EdgeEndStar.propagateSideLabels
(EdgeEndStar.java:300)
  at com/vividsolutions/jts/graph/EdgeEndStar.computeLabelling
(EdgeEndStar.java:139)
  at com/vividsolutions/jts/graph/DirectedEdgeStar.computeLabelling
(DirectedEdgeStar.java:132)
  at
com/vividsolutions/jts/operation/overlay/OverlayOp.computeLabelling
(OverlayOp.java:368)
  at com/vividsolutions/jts/operation/overlay/OverlayOp.computeOverlay
(OverlayOp.java:173)
  at
com/vividsolutions/jts/operation/overlay/OverlayOp.getResultGeometry
(OverlayOp.java:122)
  at com/vividsolutions/jts/operation/overlay/OverlayOp.overlayOp
(OverlayOp.java:64)
  at com/vividsolutions/jts/geom/Geometry.union (Geometry.java:810)

Any hints as to how I might proceed solving this, or what this
exception means? Alternatively, is there a way to build the relevant
Polygons out of a union of LineStrings?

Regarding semantics (if I understand this term in this context, not
being a trained IT professional) I can see several options, for
example:
1)
The interface stays as it is, and Geometry.union is also implemented
for GeometryCollections. As you suggested, to create a union of a
GeometryCollection you would then perform a union with an empty
Geometry. This seems a bit counter-intuititive as the term 'union'
does not seem to describe what would actually happen. Theoretically
the union of set A with an empty set B should always be identical to
set A (?) But the union of a MultiPolygon with the empty Geometry
could produce a completely different Geometry as a result.
2)
A union is redefined as an operation which also functions with a
single operand. So in addition to overlayOp(Geometry geom0, Geometry
geom1, int opCode) you would have overlayOp(Geometry geom0, int
opCode) (and hence Geometry.union()) This seems to me to better
capture the idea of trying to perform a union upon a collection. I
don't know if this could also be meaningful for self-intersecting
Geometries which are not collections.
3)
Alternatively one could use a different term for the special case of
creating a union of all elements in a GeometryCollection e.g. flatten
(), collapse(), removeOverlap(), unify().

I vote for option 2.

Well, I hope an optimised functionality for OverlayOps on
GeometryCollections is introduced in a future release of JTS to make
a wonderful library, even better!

cheers,
Rob Meek


--- In jts_discussion@..., "Martin Davis" <mbdavis@v...>
wrote:
> Andy,
>
> I haven't thought about this in detail enough to say whether your
proposed changes are sufficient to implement union of multiple
polygons.  My gut feel is that it will take more than this to
implement this correctly.  Also, I think your proposal of simply
repeating the computeSelfNodes() won't provide any speed advantage
over simply repeating the union() method.  What's needed is a way of
presenting all components of the geometry to the intersection finding
code at once, so that it can search through all line segments once
only.
>
>
> Martin Davis, Senior Technical Architect
>
> Vivid Solutions Inc.
>
> Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
>
> Phone: (250) 385 6040    Fax: (250) 385 6046
>
> EMail: mbdavis@v...  Web: www.vividsolutions.com
>
> -----Original Message-----
> From: Coats, Andy W [mailto:awcoats@u...]
> Sent: Monday, June 23, 2003 10:09 AM
> To: jts_discussion@...
> Subject: RE: [jts_discussion] Union of many polygons
>
>
>
> I was wanting to a union of multiple polygons in one operation too
but decided it was not priority since we do the union of polygon in a
batch process and therefore are too concerned about the speed (and
I'm still not done getting the JTS 1.3 changes into Geotools.Net)
>
>
>
> Just for my own interest, am I correct in my understanding, where
arg is now of size 2, if this was increased dynamically the existing
code would just need to use a loop in the places marked *****
>
>
>
> I was unsure about the call to computeEdgeIntersections () - would
it have to check each arg with each other arg?
>
>
>
> As to the semantics of the other operations working on a
collection - intersection seems fairly straight forward. I'm not sure
how useful difference and symmetric difference on a collection is.
>
>
>
>
>
> Andrew Coats
>
>
>
> private void GCUnion()
>
>   {
>
>     // copy points from input Geometries.
>
>     // This ensures that any Point geometries
>
>     // in the input are considered for inclusion in the result set
>
>     copyPoints(0);
>
>     copyPoints(1);
>
>     copyPoints(N); ********
>
>
>
>
>
>     // node the input Geometries
>
>     arg[0].computeSelfNodes(li, false);
>
>     arg[1].computeSelfNodes(li, false);
>
>     arg[N].computeSelfNodes(li, false);*********
>
>
>
>
>
>     // compute intersections between edges of the two input
geometries
>
>     arg[0].computeEdgeIntersections(arg[1], li, true);
>
>
>
>     List baseSplitEdges = new ArrayList();
>
>     arg[0].computeSplitEdges(baseSplitEdges);
>
>     arg[1].computeSplitEdges(baseSplitEdges);
>
>     arg[N].computeSplitEdges(baseSplitEdges);******
>
>
>
>     List splitEdges = baseSplitEdges;
>
>     // add the noded edges to this result graph
>
>     insertUniqueEdges(baseSplitEdges);
>
>
>
>     computeLabelsFromDepths();
>
>     replaceCollapsedEdges();
>
>     graph.addEdges(edgeList);
>
>     computeLabelling();
>
>     labelIncompleteNodes();
>
>
>
>
>
>     /**
>
>      * The ordering of building the result Geometries is important.
>
>      * Areas must be built before lines, which must be built before
points.
>
>      * This is so that lines which are covered by areas are not
included
>
>      * explicitly, and similarly for points.
>
>      */
>
>     findResultAreaEdges(opCode);
>
>     cancelDuplicateResultEdges();
>
>     PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);
>
>     polyBuilder.add(graph);
>
>     resultPolyList = polyBuilder.getPolygons();
>
>
>
>     LineBuilder lineBuilder = new LineBuilder(this, geomFact,
ptLocator);
>
>     resultLineList = lineBuilder.build(opCode);
>
>
>
>     PointBuilder pointBuilder = new PointBuilder(this, geomFact,
ptLocator);
>
>     resultPointList = pointBuilder.build(opCode);
>
>
>
>     // gather the results from all calculations into a single
Geometry for the result set
>
>     resultGeom = computeGeometry(resultPointList, resultLineList,
resultPolyList);
>
>   }
>
>
>
>
>
>
>   _____
>
>
> From: Martin Davis [mailto:mbdavis@v...]
> Sent: Monday, June 23, 2003 12:37 PM
> To: jts_discussion@...
>
>
>
> Unfortunately in the current API there is no way to optimize the
operation of "Union of many polygons".  But you're right in
suspecting that there *is* a faster way of doing this.  What's
required is a way to compute all intersections of all polygons at the
same time, and then construct the resulting union.  The code is all
basically there inside JTS, it's just not exposed in a way that
allows the user to specify that he wants to do this.
>
> Part of the problem is that the OGC SFS API is really focussed in
operations on pairs of Geometrys, not collections.  Of course, there
is the GeometryCollection class, which could provide this capability
if the semantics of spatial operations were defined appropriately.
There weren't really any semantics specified for GeometryCollections
in the SFS, and there were some tricky issues in handling GC's
robustly, so we didn't pursue implementing the operations over GCs.
However, if we implemented the obvious union semantics for GCs for
the spatial operations that would allow exposing an optimized "Union
of many polygons" in a clean way.  (You would form a GC of all the
polygons and then union it with the empty geometry.  Under the covers
JTS would first union all the polygons in the GC).
>
> Any feedback on this issue of defining semantics for GCs is
welcome.
>
> Martin Davis, Senior Technical Architect
> Vivid Solutions Inc.
> Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> Phone: (250) 385 6040    Fax: (250) 385 6046
> EMail: mbdavis@v...  Web: www.vividsolutions.com
>
>
> > -----Original Message-----
> > From: robmeek355 [mailto:register@r...]
> > Sent: Sunday, June 22, 2003 6:44 AM
> > To: jts_discussion@...
> > Subject: [jts_discussion] Union of many polygons
> >
> >
> > Hi there,
> > I'm using JTS to perform unions on groups of 50-70 overlapping
> > polygons in a java font editing experiment. The polygons
themselves
> > are relatively simple and most of the time JTS works great. I
loop
> > over all the polygons checking for intersections with all of the
> > other polygons, and keep going till there are no more
intersections.
> > But this is all a bit slow. Is there a quicker/better/correct
way?
> > Can I collect all of the polygons into some kind of collection
and
> > then perform a single clipping operation on that -reducing the
50+
> > polygons to a single or at least simplified set of shapes in one
fell
> > swoop?
> > Thanks for any help,
> > Rob Meek
> >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://ca.yahoo.com/docs/info/tos.html
> >
> >
> >
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://ca.yahoo.com/docs/info/tos.html> Service.
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://ca.yahoo.com/docs/info/tos.html> Service.

#355 From: Aron Olsen <aro@...>
Date: Tue Jul 1, 2003 7:00 am
Subject: RE: Re: Union of many polygons
aronolsen
Send Email Send Email
 

Hi there,

 

I vote for 2 too (self-union).

Another operation which I would like to see in there is a "self-dissolve", an operation where you obtain all the chopped up, non-intersecting and non-overlapping components of a collection. Maybe I better take a closer look at JCS, now it has been released.

Aron

 

-----Original Message-----
From: robmeek355 [mailto:register@...]
Sent: 30. juni 2003 12:16
To: jts_discussion@...
Subject: [jts_discussion] Re: Union of many polygons

 

Hallo again,

I'm still pondering the issue of performing a quicker union of
multiple polygons.

I can see now that the code is already there, at least to calculate
the intersections quickly without having to loop over the Geometries.
For example, having commented out the checkNotGeometryCollection
functions in Geometry.union, a union of a MultiLineString collection
with an empty Geometry runs without complaint, and produces a
collection of correctly chopped LineStrings.

When I run the code with a MultiPolygon however I always get this
TopologyException as the computeLabelling function is called:

com.vividsolutions.jts.geom.TopologyException: side location conflict
[ (76.36317151874525, 101.53496246981595, NaN) ]
at com/vividsolutions/jts/graph/EdgeEndStar.propagateSideLabels
(EdgeEndStar.java:300)
at com/vividsolutions/jts/graph/EdgeEndStar.computeLabelling
(EdgeEndStar.java:139)
at com/vividsolutions/jts/graph/DirectedEdgeStar.computeLabelling
(DirectedEdgeStar.java:132)
at
com/vividsolutions/jts/operation/overlay/OverlayOp.computeLabelling
(OverlayOp.java:368)
at com/vividsolutions/jts/operation/overlay/OverlayOp.computeOverlay
(OverlayOp.java:173)
at
com/vividsolutions/jts/operation/overlay/OverlayOp.getResultGeometry
(OverlayOp.java:122)
at com/vividsolutions/jts/operation/overlay/OverlayOp.overlayOp
(OverlayOp.java:64)
at com/vividsolutions/jts/geom/Geometry.union (Geometry.java:810)

Any hints as to how I might proceed solving this, or what this
exception means? Alternatively, is there a way to build the relevant
Polygons out of a union of LineStrings?

Regarding semantics (if I understand this term in this context, not
being a trained IT professional) I can see several options, for
example:
1)
The interface stays as it is, and Geometry.union is also implemented
for GeometryCollections. As you suggested, to create a union of a
GeometryCollection you would then perform a union with an empty
Geometry. This seems a bit counter-intuititive as the term 'union'
does not seem to describe what would actually happen. Theoretically
the union of set A with an empty set B should always be identical to
set A (?) But the union of a MultiPolygon with the empty Geometry
could produce a completely different Geometry as a result.
2)
A union is redefined as an operation which also functions with a
single operand. So in addition to overlayOp(Geometry geom0, Geometry
geom1, int opCode) you would have overlayOp(Geometry geom0, int
opCode) (and hence Geometry.union()) This seems to me to better
capture the idea of trying to perform a union upon a collection. I
don't know if this could also be meaningful for self-intersecting
Geometries which are not collections.
3)
Alternatively one could use a different term for the special case of
creating a union of all elements in a GeometryCollection e.g. flatten
(), collapse(), removeOverlap(), unify().

I vote for option 2.

Well, I hope an optimised functionality for OverlayOps on
GeometryCollections is introduced in a future release of JTS to make
a wonderful library, even better!

cheers,
Rob Meek


--- In jts_discussion@..., "Martin Davis" <mbdavis@v...>
wrote:
> Andy,

> I haven't thought about this in detail enough to say whether your
proposed changes are sufficient to implement union of multiple
polygons.  My gut feel is that it will take more than this to
implement this correctly.  Also, I think your proposal of simply
repeating the computeSelfNodes() won't provide any speed advantage
over simply repeating the union() method.  What's needed is a way of
presenting all components of the geometry to the intersection finding
code at once, so that it can search through all line segments once
only.

>
> Martin Davis, Senior Technical Architect
>
> Vivid Solutions Inc.
>
> Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
>
> Phone: (250) 385 6040    Fax: (250) 385 6046
>
> EMail: mbdavis@v...  Web: www.vividsolutions.com
>
> -----Original Message-----
> From: Coats, Andy W [mailto:awcoats@u...]
> Sent: Monday, June 23, 2003 10:09 AM
> To: jts_discussion@...
> Subject: RE: [jts_discussion] Union of many polygons
>
>
>
> I was wanting to a union of multiple polygons in one operation too
but decided it was not priority since we do the union of polygon in a
batch process and therefore are too concerned about the speed (and
I'm still not done getting the JTS 1.3 changes into Geotools.Net)
>

>
> Just for my own interest, am I correct in my understanding, where
arg is now of size 2, if this was increased dynamically the existing
code would just need to use a loop in the places marked *****
>

>
> I was unsure about the call to computeEdgeIntersections () - would
it have to check each arg with each other arg?
>

>
> As to the semantics of the other operations working on a
collection - intersection seems fairly straight forward. I'm not sure
how useful difference and symmetric difference on a collection is.
>

>

>
> Andrew Coats
>

>
> private void GCUnion()
>
>   {
>
>     // copy points from input Geometries.
>
>     // This ensures that any Point geometries
>
>     // in the input are considered for inclusion in the result set
>
>     copyPoints(0);
>
>     copyPoints(1);
>
>     copyPoints(N); ********
>

>

>
>     // node the input Geometries
>
>     arg[0].computeSelfNodes(li, false);
>
>     arg[1].computeSelfNodes(li, false);
>
>     arg[N].computeSelfNodes(li, false);*********
>

>

>
>     // compute intersections between edges of the two input
geometries
>
>     arg[0].computeEdgeIntersections(arg[1], li, true);
>

>
>     List baseSplitEdges = new ArrayList();
>
>     arg[0].computeSplitEdges(baseSplitEdges);
>
>     arg[1].computeSplitEdges(baseSplitEdges);
>
>     arg[N].computeSplitEdges(baseSplitEdges);******
>

>
>     List splitEdges = baseSplitEdges;
>
>     // add the noded edges to this result graph
>
>     insertUniqueEdges(baseSplitEdges);
>

>
>     computeLabelsFromDepths();
>
>     replaceCollapsedEdges();
>
>     graph.addEdges(edgeList);
>
>     computeLabelling();
>
>     labelIncompleteNodes();
>

>

>
>     /**
>
>      * The ordering of building the result Geometries is important.
>
>      * Areas must be built before lines, which must be built before
points.
>
>      * This is so that lines which are covered by areas are not
included
>
>      * explicitly, and similarly for points.
>
>      */
>
>     findResultAreaEdges(opCode);
>
>     cancelDuplicateResultEdges();
>
>     PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);
>
>     polyBuilder.add(graph);
>
>     resultPolyList = polyBuilder.getPolygons();
>

>
>     LineBuilder lineBuilder = new LineBuilder(this, geomFact,
ptLocator);
>
>     resultLineList = lineBuilder.build(opCode);
>

>
>     PointBuilder pointBuilder = new PointBuilder(this, geomFact,
ptLocator);
>
>     resultPointList = pointBuilder.build(opCode);
>

>
>     // gather the results from all calculations into a single
Geometry for the result set
>
>     resultGeom = computeGeometry(resultPointList, resultLineList,
resultPolyList);
>
>   }
>

>

>
>
>   _____ 
>
>
> From: Martin Davis [mailto:mbdavis@v...]
> Sent: Monday, June 23, 2003 12:37 PM
> To: jts_discussion@...
>

>
> Unfortunately in the current API there is no way to optimize the
operation of "Union of many polygons".  But you're right in
suspecting that there *is* a faster way of doing this.  What's
required is a way to compute all intersections of all polygons at the
same time, and then construct the resulting union.  The code is all
basically there inside JTS, it's just not exposed in a way that
allows the user to specify that he wants to do this. 
>
> Part of the problem is that the OGC SFS API is really focussed in
operations on pairs of Geometrys, not collections.  Of course, there
is the GeometryCollection class, which could provide this capability
if the semantics of spatial operations were defined appropriately. 
There weren't really any semantics specified for GeometryCollections
in the SFS, and there were some tricky issues in handling GC's
robustly, so we didn't pursue implementing the operations over GCs. 
However, if we implemented the obvious union semantics for GCs for
the spatial operations that would allow exposing an optimized "Union
of many polygons" in a clean way.  (You would form a GC of all the
polygons and then union it with the empty geometry.  Under the covers
JTS would first union all the polygons in the GC).
>
> Any feedback on this issue of defining semantics for GCs is
welcome. 
>
> Martin Davis, Senior Technical Architect
> Vivid Solutions Inc.
> Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> Phone: (250) 385 6040    Fax: (250) 385 6046
> EMail: mbdavis@v...  Web: www.vividsolutions.com
>
>
> > -----Original Message-----
> > From: robmeek355 [mailto:register@r...]
> > Sent: Sunday, June 22, 2003 6:44 AM
> > To: jts_discussion@...
> > Subject: [jts_discussion] Union of many polygons
> >
> >
> > Hi there,
> > I'm using JTS to perform unions on groups of 50-70 overlapping
> > polygons in a java font editing experiment. The polygons
themselves
> > are relatively simple and most of the time JTS works great. I
loop
> > over all the polygons checking for intersections with all of the
> > other polygons, and keep going till there are no more
intersections.
> > But this is all a bit slow. Is there a quicker/better/correct
way?
> > Can I collect all of the polygons into some kind of collection
and
> > then perform a single clipping operation on that -reducing the
50+
> > polygons to a single or at least simplified set of shapes in one
fell
> > swoop?
> > Thanks for any help,
> > Rob Meek
> >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> > 
> >
> > Your use of Yahoo! Groups is subject to
> > http://ca.yahoo.com/docs/info/tos.html
> >
> >
> >
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
<http://ca.yahoo.com/docs/info/tos.html> Service.
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
<http://ca.yahoo.com/docs/info/tos.html> Service.


To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



#356 From: "Martin Davis" <mbdavis@...>
Date: Fri Jul 4, 2003 5:06 pm
Subject: RE: Re: Union of many polygons
mbdavis@...
Send Email Send Email
 
> When I run the code with a MultiPolygon however I always get this
> TopologyException

Probably because your MultiPolygon is not valid.  Don't forget, MultiPolygons
can't contain overlapping polygons (which I think is what your application
requires).

The basic features are mostly there in JTS, but it will still take work to glue
them together appropriately to make the union thing work.  Actually, after a bit
of reflection it may be even tougher than this - the assumption that area
components don't overlap is built into the algorithms fairly deeply.

I have polygonization code in JCS, and I'm considering moving this to JTS.  That
again isn't quite what you want, but it's more machinery to work with.

Thanks for the API suggestions - they're good ones.  I think there's a
reasonable escape from your comments about the semantics of union in option 1. 
Union operates at the point-set level, but is allowed to choose any
representation for the point set returned.  In particular, it can choose the
simplest representation - a set of non-overlapping, merged polygons.  This is
the most useful semantics - after all, it's trivial to implement the alternative
one of simply collecting every input into a single GeometryCollection without
changing it.

Not sure whether it's best to overload union (and intersection, to make Aron
happy), or to come up with alternative method names.  In any case, the
underlying implementing classes will almost certainly be different to the
OverlayOp.

I hope to have some time to think about this in the near future.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: robmeek355 [mailto:register@...]
> Sent: Monday, June 30, 2003 4:16 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Re: Union of many polygons
>
>
> Hallo again,
>
> I'm still pondering the issue of performing a quicker union of
> multiple polygons.
>
> I can see now that the code is already there, at least to calculate
> the intersections quickly without having to loop over the Geometries.
> For example, having commented out the checkNotGeometryCollection
> functions in Geometry.union, a union of a MultiLineString collection
> with an empty Geometry runs without complaint, and produces a
> collection of correctly chopped LineStrings.
>
> When I run the code with a MultiPolygon however I always get this
> TopologyException as the computeLabelling function is called:
>
> com.vividsolutions.jts.geom.TopologyException: side location conflict
> [ (76.36317151874525, 101.53496246981595, NaN) ]
>  at com/vividsolutions/jts/graph/EdgeEndStar.propagateSideLabels
> (EdgeEndStar.java:300)
>  at com/vividsolutions/jts/graph/EdgeEndStar.computeLabelling
> (EdgeEndStar.java:139)
>  at com/vividsolutions/jts/graph/DirectedEdgeStar.computeLabelling
> (DirectedEdgeStar.java:132)
>  at
> com/vividsolutions/jts/operation/overlay/OverlayOp.computeLabelling
> (OverlayOp.java:368)
>  at com/vividsolutions/jts/operation/overlay/OverlayOp.computeOverlay
> (OverlayOp.java:173)
>  at
> com/vividsolutions/jts/operation/overlay/OverlayOp.getResultGeometry
> (OverlayOp.java:122)
>  at com/vividsolutions/jts/operation/overlay/OverlayOp.overlayOp
> (OverlayOp.java:64)
>  at com/vividsolutions/jts/geom/Geometry.union (Geometry.java:810)
>
> Any hints as to how I might proceed solving this, or what this
> exception means? Alternatively, is there a way to build the relevant
> Polygons out of a union of LineStrings?
>
> Regarding semantics (if I understand this term in this context, not
> being a trained IT professional) I can see several options, for
> example:
> 1)
> The interface stays as it is, and Geometry.union is also implemented
> for GeometryCollections. As you suggested, to create a union of a
> GeometryCollection you would then perform a union with an empty
> Geometry. This seems a bit counter-intuititive as the term 'union'
> does not seem to describe what would actually happen. Theoretically
> the union of set A with an empty set B should always be identical to
> set A (?) But the union of a MultiPolygon with the empty Geometry
> could produce a completely different Geometry as a result.
> 2)
> A union is redefined as an operation which also functions with a
> single operand. So in addition to overlayOp(Geometry geom0, Geometry
> geom1, int opCode) you would have overlayOp(Geometry geom0, int
> opCode) (and hence Geometry.union()) This seems to me to better
> capture the idea of trying to perform a union upon a collection. I
> don't know if this could also be meaningful for self-intersecting
> Geometries which are not collections.
> 3)
> Alternatively one could use a different term for the special case of
> creating a union of all elements in a GeometryCollection e.g. flatten
> (), collapse(), removeOverlap(), unify().
>
> I vote for option 2.
>
> Well, I hope an optimised functionality for OverlayOps on
> GeometryCollections is introduced in a future release of JTS to make
> a wonderful library, even better!
>
> cheers,
> Rob Meek
>
>
> --- In jts_discussion@..., "Martin Davis" <mbdavis@v...>
> wrote:
> > Andy,
> >
> > I haven't thought about this in detail enough to say whether your
> proposed changes are sufficient to implement union of multiple
> polygons.  My gut feel is that it will take more than this to
> implement this correctly.  Also, I think your proposal of simply
> repeating the computeSelfNodes() won't provide any speed advantage
> over simply repeating the union() method.  What's needed is a way of
> presenting all components of the geometry to the intersection finding
> code at once, so that it can search through all line segments once
> only.
> >
> >
> > Martin Davis, Senior Technical Architect
> >
> > Vivid Solutions Inc.
> >
> > Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> >
> > Phone: (250) 385 6040    Fax: (250) 385 6046
> >
> > EMail: mbdavis@v...  Web: www.vividsolutions.com
> >
> > -----Original Message-----
> > From: Coats, Andy W [mailto:awcoats@u...]
> > Sent: Monday, June 23, 2003 10:09 AM
> > To: jts_discussion@...
> > Subject: RE: [jts_discussion] Union of many polygons
> >
> >
> >
> > I was wanting to a union of multiple polygons in one operation too
> but decided it was not priority since we do the union of polygon in a
> batch process and therefore are too concerned about the speed (and
> I'm still not done getting the JTS 1.3 changes into Geotools.Net)
> >
> >
> >
> > Just for my own interest, am I correct in my understanding, where
> arg is now of size 2, if this was increased dynamically the existing
> code would just need to use a loop in the places marked *****
> >
> >
> >
> > I was unsure about the call to computeEdgeIntersections () - would
> it have to check each arg with each other arg?
> >
> >
> >
> > As to the semantics of the other operations working on a
> collection - intersection seems fairly straight forward. I'm not sure
> how useful difference and symmetric difference on a collection is.
> >
> >
> >
> >
> >
> > Andrew Coats
> >
> >
> >
> > private void GCUnion()
> >
> >   {
> >
> >     // copy points from input Geometries.
> >
> >     // This ensures that any Point geometries
> >
> >     // in the input are considered for inclusion in the result set
> >
> >     copyPoints(0);
> >
> >     copyPoints(1);
> >
> >     copyPoints(N); ********
> >
> >
> >
> >
> >
> >     // node the input Geometries
> >
> >     arg[0].computeSelfNodes(li, false);
> >
> >     arg[1].computeSelfNodes(li, false);
> >
> >     arg[N].computeSelfNodes(li, false);*********
> >
> >
> >
> >
> >
> >     // compute intersections between edges of the two input
> geometries
> >
> >     arg[0].computeEdgeIntersections(arg[1], li, true);
> >
> >
> >
> >     List baseSplitEdges = new ArrayList();
> >
> >     arg[0].computeSplitEdges(baseSplitEdges);
> >
> >     arg[1].computeSplitEdges(baseSplitEdges);
> >
> >     arg[N].computeSplitEdges(baseSplitEdges);******
> >
> >
> >
> >     List splitEdges = baseSplitEdges;
> >
> >     // add the noded edges to this result graph
> >
> >     insertUniqueEdges(baseSplitEdges);
> >
> >
> >
> >     computeLabelsFromDepths();
> >
> >     replaceCollapsedEdges();
> >
> >     graph.addEdges(edgeList);
> >
> >     computeLabelling();
> >
> >     labelIncompleteNodes();
> >
> >
> >
> >
> >
> >     /**
> >
> >      * The ordering of building the result Geometries is important.
> >
> >      * Areas must be built before lines, which must be built before
> points.
> >
> >      * This is so that lines which are covered by areas are not
> included
> >
> >      * explicitly, and similarly for points.
> >
> >      */
> >
> >     findResultAreaEdges(opCode);
> >
> >     cancelDuplicateResultEdges();
> >
> >     PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);
> >
> >     polyBuilder.add(graph);
> >
> >     resultPolyList = polyBuilder.getPolygons();
> >
> >
> >
> >     LineBuilder lineBuilder = new LineBuilder(this, geomFact,
> ptLocator);
> >
> >     resultLineList = lineBuilder.build(opCode);
> >
> >
> >
> >     PointBuilder pointBuilder = new PointBuilder(this, geomFact,
> ptLocator);
> >
> >     resultPointList = pointBuilder.build(opCode);
> >
> >
> >
> >     // gather the results from all calculations into a single
> Geometry for the result set
> >
> >     resultGeom = computeGeometry(resultPointList, resultLineList,
> resultPolyList);
> >
> >   }
> >
> >
> >
> >
> >
> >
> >   _____
> >
> >
> > From: Martin Davis [mailto:mbdavis@v...]
> > Sent: Monday, June 23, 2003 12:37 PM
> > To: jts_discussion@...
> >
> >
> >
> > Unfortunately in the current API there is no way to optimize the
> operation of "Union of many polygons".  But you're right in
> suspecting that there *is* a faster way of doing this.  What's
> required is a way to compute all intersections of all polygons at the
> same time, and then construct the resulting union.  The code is all
> basically there inside JTS, it's just not exposed in a way that
> allows the user to specify that he wants to do this.
> >
> > Part of the problem is that the OGC SFS API is really focussed in
> operations on pairs of Geometrys, not collections.  Of course, there
> is the GeometryCollection class, which could provide this capability
> if the semantics of spatial operations were defined appropriately.
> There weren't really any semantics specified for GeometryCollections
> in the SFS, and there were some tricky issues in handling GC's
> robustly, so we didn't pursue implementing the operations over GCs.
> However, if we implemented the obvious union semantics for GCs for
> the spatial operations that would allow exposing an optimized "Union
> of many polygons" in a clean way.  (You would form a GC of all the
> polygons and then union it with the empty geometry.  Under the covers
> JTS would first union all the polygons in the GC).
> >
> > Any feedback on this issue of defining semantics for GCs is
> welcome.
> >
> > Martin Davis, Senior Technical Architect
> > Vivid Solutions Inc.
> > Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> > Phone: (250) 385 6040    Fax: (250) 385 6046
> > EMail: mbdavis@v...  Web: www.vividsolutions.com
> >
> >
> > > -----Original Message-----
> > > From: robmeek355 [mailto:register@r...]
> > > Sent: Sunday, June 22, 2003 6:44 AM
> > > To: jts_discussion@...
> > > Subject: [jts_discussion] Union of many polygons
> > >
> > >
> > > Hi there,
> > > I'm using JTS to perform unions on groups of 50-70 overlapping
> > > polygons in a java font editing experiment. The polygons
> themselves
> > > are relatively simple and most of the time JTS works great. I
> loop
> > > over all the polygons checking for intersections with all of the
> > > other polygons, and keep going till there are no more
> intersections.
> > > But this is all a bit slow. Is there a quicker/better/correct
> way?
> > > Can I collect all of the polygons into some kind of collection
> and
> > > then perform a single clipping operation on that -reducing the
> 50+
> > > polygons to a single or at least simplified set of shapes in one
> fell
> > > swoop?
> > > Thanks for any help,
> > > Rob Meek
> > >
> > >
> > > To unsubscribe from this group, send an email to:
> > > jts_discussion-unsubscribe@...
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://ca.yahoo.com/docs/info/tos.html
> > >
> > >
> > >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> <http://ca.yahoo.com/docs/info/tos.html> Service.
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> <http://ca.yahoo.com/docs/info/tos.html> Service.
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

#357 From: "modenait3550" <modena360@...>
Date: Wed Jul 16, 2003 3:14 pm
Subject: Problem with polygons intersection
modenait3550
Send Email Send Email
 
Hello,

  I use the jts pakage but I ve the following problem :

  com.vividsolutions.jts.geom.TopologyException: side location
conflict [ (600.0, 0.5, NaN) ]

  while computing the intersection between the two polygons :
p1 POLYGON ((600 0.5, 1650 0.5, 1650 1.6, 1274 1.6, 1274 1.5, 1244
1.5, 1244 1.4, 1209 1.4, 1209 1.3, 1168 1.3, 1168 1.2, 1120 1.2, 1120
1.1, 1064 1.1, 1064 1, 998 1, 998 0.9, 922 0.9, 922 0.8, 832 0.8, 832
0.7, 729 0.7, 729 0.6, 612 0.6, 612 0.5, 600 0.5))

and

p2 POLYGON ((800 0.35, 1100 0.35, 1100 0.4, 1200 0.4, 1200 0.45, 1350
0.45, 1350 0.5, 1500 0.5, 1500 0.6, 1600 0.6, 1600 1.6, 1550 1.6,
1550 1.8, 1550 1.9, 1500 1.9, 1500 2, 800 2, 800 1.6, 800 0.35))

  can u tel me more about this error ? thanx a lot.

#358 From: "Martin Davis" <mbdavis@...>
Date: Wed Jul 16, 2003 3:44 pm
Subject: RE: Problem with polygons intersection
mbdavis@...
Send Email Send Email
 
Polygon 1 is invalid - it has a self-intersection caused by the coindicence of
the line segments between the points (600 0.5, 1650 0.5, 612 0.5)

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: modenait3550 [mailto:modena360@...]
> Sent: Wednesday, July 16, 2003 8:15 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Problem with polygons intersection
>
>
>  Hello,
>
>  I use the jts pakage but I ve the following problem :
>
>  com.vividsolutions.jts.geom.TopologyException: side location
> conflict [ (600.0, 0.5, NaN) ]
>
>  while computing the intersection between the two polygons :
> p1 POLYGON ((600 0.5, 1650 0.5, 1650 1.6, 1274 1.6, 1274 1.5, 1244
> 1.5, 1244 1.4, 1209 1.4, 1209 1.3, 1168 1.3, 1168 1.2, 1120 1.2, 1120
> 1.1, 1064 1.1, 1064 1, 998 1, 998 0.9, 922 0.9, 922 0.8, 832 0.8, 832
> 0.7, 729 0.7, 729 0.6, 612 0.6, 612 0.5, 600 0.5))
>
> and
>
> p2 POLYGON ((800 0.35, 1100 0.35, 1100 0.4, 1200 0.4, 1200 0.45, 1350
> 0.45, 1350 0.5, 1500 0.5, 1500 0.6, 1600 0.6, 1600 1.6, 1550 1.6,
> 1550 1.8, 1550 1.9, 1500 1.9, 1500 2, 800 2, 800 1.6, 800 0.35))
>
>  can u tel me more about this error ? thanx a lot.
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

#359 From: "modenait3550" <modena360@...>
Date: Thu Jul 17, 2003 3:42 pm
Subject: (No subject)
modenait3550
Send Email Send Email
 
Thanx but now i have the same pb with this two following polygons :
P1
POLYGON ((1600 0.4, 1600 0.48, 1651 0.48, 1651 0.5, 1700 0.5, 1700
0.56, 1750 0.56, 1750 0.6, 1850 0.6, 1850 3, 650 3, 650 0.4, 1600
0.4))

P2
POLYGON ((775 0.4, 1870 0.5, 1870 2.25, 775 2.25, 775 0.4))


P1 and P2 seems to be valid, but compting their intersection :
com.vividsolutions.jts.geom.TopologyException: side location conflict
[ (1651.0, 0.48, NaN) ]

In fact I'm afraid the point (1651 0.48) witch defines P1 also is an
intersection point between P1 and P2 ! Is this a bug or is my case
invalid ?

  regards.

#360 From: "Martin Davis" <mbdavis@...>
Date: Thu Jul 17, 2003 6:56 pm
Subject: RE: (unknown)
mbdavis@...
Send Email Send Email
 
Well, after some investigation it looks like you might have hit a actual
robustness failure within JTS.  Remember, the algorithms used for the boolean
operations (intersection, etc) are unfortunately not 100% robust.  I don't have
time to track the problem down further right now, but in any case we don't
currently have an algorithmic solution to this problem.

I'll file this case in my bestiary of nasty examples and will hopefully get a
chance to address the robustness problem in a future version of JTS.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: modenait3550 [mailto:modena360@...]
> Sent: Thursday, July 17, 2003 8:43 AM
> To: jts_discussion@...
> Subject: [jts_discussion] (unknown)
>
>
> Thanx but now i have the same pb with this two following polygons :
> P1
> POLYGON ((1600 0.4, 1600 0.48, 1651 0.48, 1651 0.5, 1700 0.5, 1700
> 0.56, 1750 0.56, 1750 0.6, 1850 0.6, 1850 3, 650 3, 650 0.4, 1600
> 0.4))
>
> P2
> POLYGON ((775 0.4, 1870 0.5, 1870 2.25, 775 2.25, 775 0.4))
>
>
> P1 and P2 seems to be valid, but compting their intersection :
> com.vividsolutions.jts.geom.TopologyException: side location conflict
> [ (1651.0, 0.48, NaN) ]
>
> In fact I'm afraid the point (1651 0.48) witch defines P1 also is an
> intersection point between P1 and P2 ! Is this a bug or is my case
> invalid ?
>
>  regards.
>
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>
>
>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

#361 From: "register" <register@...>
Date: Sun Jul 20, 2003 7:38 pm
Subject: Re: Re: Union of many polygons
robmeek355
Send Email Send Email
 
I think I've got at least the beginnings of a working solution to my problem now. Here is an example applet:
 
 
Hopefully, once I've tidied things up, I can include source for anyone who is interested.
 
Cheers,
Rob Meek
----- Original Message -----
Sent: Friday, July 04, 2003 7:06 PM
Subject: RE: [jts_discussion] Re: Union of many polygons

> When I run the code with a MultiPolygon however I always get this
> TopologyException

Probably because your MultiPolygon is not valid.  Don't forget, MultiPolygons can't contain overlapping polygons (which I think is what your application requires).

The basic features are mostly there in JTS, but it will still take work to glue them together appropriately to make the union thing work.  Actually, after a bit of reflection it may be even tougher than this - the assumption that area components don't overlap is built into the algorithms fairly deeply.

I have polygonization code in JCS, and I'm considering moving this to JTS.  That again isn't quite what you want, but it's more machinery to work with.

Thanks for the API suggestions - they're good ones.  I think there's a reasonable escape from your comments about the semantics of union in option 1.  Union operates at the point-set level, but is allowed to choose any representation for the point set returned.  In particular, it can choose the simplest representation - a set of non-overlapping, merged polygons.  This is the most useful semantics - after all, it's trivial to implement the alternative one of simply collecting every inpu t into a single GeometryCollection without changing it.

Not sure whether it's best to overload union (and intersection, to make Aron happy), or to come up with alternative method names.  In any case, the underlying implementing classes will almost certainly be different to the OverlayOp.

I hope to have some time to think about this in the near future.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis@...  Web: www.vividsolutions.com


> -----Original Message-----
> From: robmeek355 [mailto:register@...]
> Sent: Monday, June 30, 2003 4:16 AM
> To: jts_discussion@...
> Subject: [jts_discussion] Re: Union of many polygons
>
>
> Hallo again,
>
> I'm still pondering the issue of performing a quicker union of
> multiple polygons.
>
> I can see now that the code is already there, at least to calculate
> the intersections quickly without having to loop over the Geometries.
> For example, having commented out the checkNotGeometryCollection
> functions in Geometry.union, a union of a MultiLineString collection
> with an empty Geometry runs without complaint, and produces a
> collection of correctly chopped LineStrings.
>
> When I run the code with a MultiPolygon however I always get this
> TopologyException as the computeLabelling function is called:
>
> com.vividsolutions.jts.geom.TopologyException: side location conflict
> [ (76.36317151874525, 101.53496246981595, NaN) ]
>  at com/vividsolutions/jts/graph/EdgeEndStar.propagateSideLabels
> (EdgeEndStar.java:300)
>  at com/vividsolutions/jts/graph/EdgeEndStar.computeLabelling
> (EdgeEndStar.java:139)
>  at com/vividsolutions/jts/graph/DirectedEdgeStar.computeLabelling
> (DirectedEdgeStar.java:132)
>  at
> com/vividsolutions/jts/operation/overlay/OverlayOp.computeLabelling
> (OverlayOp.java:368)
>  at com/vividsolutions/jts/operation/overlay/OverlayOp.computeOverlay
> (OverlayOp.java:173)
>  at
> com/vividsolutions/jts/operation/overlay/OverlayOp.getResultGeometry
> (OverlayOp.java:122)
>  at com/vividsolutions/jts/operation/overlay/OverlayOp.overlayOp
> (OverlayOp.java:64)
>  at com/vividsolutions/jts/geom/Geometry.union (Geometry.java:810)
>
> Any hints as to how I might proceed solving this, or what this
> exception means? Alternatively, is there a way to build the relevant
> Polygons out of a union of LineStrings?
>
> Regarding semantics (if I understand this term in this context, not
> being a trained IT professional) I can see several options, for
> example:
> 1)
> The interface stays as it is, and Geometry.union is also implemented
> for GeometryCollections. As you suggested, to create a union of a
> GeometryCollection you would then perform a union with an empty
> Geometry. This seems a bit counter-intuititive as the term 'union'
> does not seem to describe what would actually happen. Theoretically
> the union of set A with an empty set B should always be identical to
> set A (?) But the union of a MultiPolygon with the empty Geometry
> could produce a completely different Geometry as a result.
> 2)
> A union is redefined as an operation which also functions with a
> single operand. So in addition to overlayOp(Geometry geom0, Geometry
> geom1, int opCode) you would have overlayOp(Geometry geom0, int
> opCode) (and hence Geometry.union()) This seems to me to better
> capture the idea of trying to perform a union upon a collection. I
> don't know if this could also be meaningful for self-intersecting
> Geometries which are not collections.
> 3)
> Alternatively one could use a different term for the special case of
> creating a union of all elements in a GeometryCollection e.g. flatten
> (), collapse(), removeOverlap(), unify().
>
> I vote for option 2.
>
> Well, I hope an optimised functionality for OverlayOps on
> GeometryCollections is introduced in a future release of JTS to make
> a wonderful library, even better!
>
> cheers,
> Rob Meek
>
>
> --- In jts_discussion@..., "Martin Davis" <mbdavis@v...>
> wrote:
> > Andy,
> > 
> > I haven't thought about this in detail enough to say whether your
> proposed changes are sufficient to implement union of multiple
> polygons.  My gut feel is that it will take more than this to
> implement this correctly.  Also, I think your proposal of simply
> repeating the computeSelfNodes() won't provide any speed advantage
> over simply repeating the union() method.  What's needed is a way of
> presenting all components of the geometry to the intersection finding
> code at once, so that it can search through all line segments once
> only.
> > 
> >
> > Martin Davis, Senior Technical Architect
> >
> > Vivid Solutions Inc.
> >
> > Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> >
> > Phone: (250) 385 6040    Fax: (250) 385 6046
> >
> > EMail: mbdavis@v...  Web: www.vividsolutions.com
> >
> > -----Original Message-----
> > From: Coats, Andy W [mailto:awcoats@u...]
> > Sent: Monday, June 23, 2003 10:09 AM
> > To: jts_discussion@...
> > Subject: RE: [jts_discussion] Union of many polygons
> >
> >
> >
> > I was wanting to a union of multiple polygons in one operation too
> but decided it was not priority since we do the union of polygon in a
> batch process and therefore are too concerned about the speed (and
> I'm still not done getting the JTS 1.3 changes into Geotools.Net)
> >
> > 
> >
> > Just for my own interest, am I correct in my understanding, where
> arg is now of size 2, if this was increased dynamically the existing
> code would just need to use a loop in the places marked *****
> >
> > 
> >
> > I was unsure about the call to computeEdgeIntersections () - would
> it have to check each arg with each other arg?
> >
> > 
> >
> > As to the semantics of the other operations working on a
> collection - intersection seems fairly straight forward. I'm not sure
> how useful difference and symmetric difference on a collection is.
> >
> > 
> >
> > 
> >
> > Andrew Coats
> >
> > 
> >
> > private void GCUnion()
> >
> >   {
> >
> >     // copy points from input Geometries.
> >
> >     // This ensures that any Point geometries
> >
> >     // in the input are considered for inclusion in the result set
> >
> >     copyPoints(0);
> >
> >     copyPoints(1);
> >
> >     copyPoints(N); ********
> >
> > 
> >
> > 
> >
> >     // node the input Geometries
> >
> >     arg[0].computeSelfNodes(li, false);
> >
> >     arg[1].computeSelfNodes(li, false);
> >
> >     arg[N].computeSelfNodes(li, false);*********
> >
> > 
> >
> > 
> >
> >     // compute intersections between edges of the two input
> geometries
> >
> >     arg[0].computeEdgeIntersections(arg[1], li, true);
> >
> > 
> >
> >     List baseSplitEdges = new ArrayList();
> >
> >     arg[0].computeSplitEdges(baseSplitEdges);
> >
> >     arg[1].computeSplitEdges(baseSplitEdges);
> >
> >     arg[N].computeSplitEdges(baseSplitEdges);******
> >
> > 
> >
> >     List splitEdges = baseSplitEdges;
> >
> >     // add the noded edges to this result graph
> >
> >     insertUniqueEdges(baseSplitEdges);
> >
> > 
> >
> >     computeLabelsFromDepths();
> >
> >     replaceCollapsedEdges();
> >
> >     graph.addEdges(edgeList);
> >
> >     computeLabelling();
> >
> >     labelIncompleteNodes();
> >
> > 
> >
> > 
> >
> >     /**
> >
> >      * The ordering of building the result Geometries is important.
> >
> >      * Areas must be built before lines, which must be built before
> points.
> >
> >      * This is so that lines which are covered by areas are not
> included
> >
> >      * explicitly, and similarly for points.
> >
> >      */
> >
> >     findResultAreaEdges(opCode);
> >
> >     cancelDuplicateResultEdges();
> >
> >     PolygonBuilder polyBuilder = new PolygonBuilder(geomFact, cga);
> >
> >     polyBuilder.add(graph);
> >
> >     resultPolyList = polyBuilder.getPolygons();
> >
> > 
> >
> >     LineBuilder lineBuilder = new LineBuilder(this, geomFact,
> ptLocator);
> >
> >     resultLineList = lineBuilder.build(opCode);
> >
> > 
> >
> >     PointBuilder pointBuilder = new PointBuilder(this, geomFact,
> ptLocator);
> >
> >     resultPointList = pointBuilder.build(opCode);
> >
> > 
> >
> >     // gather the results from all calculations into a single
> Geometry for the result set
> >
> >     resultGeom = computeGeometry(resultPointList, resultLineList,
> resultPolyList);
> >
> >   }
> >
> > 
> >
> > 
> >
> >
> >   _____ 
> >
> >
> > From: Martin Davis [mailto:mbdavis@v...]
> > Sent: Monday, June 23, 2003 12:37 PM
> > To: jts_discussion@...
> >
> > 
> >
> > Unfortunately in the current API there is no way to optimize the
> operation of "Union of many polygons".  But you're right in
> suspecting that there *is* a faster way of doing this.  What's
> required is a way to compute all intersections of all polygons at the
> same time, and then construct the resulting union.  The code is all
> basically there inside JTS, it's just not exposed in a way that
> allows the user to specify that he wants to do this. 
> >
> > Part of the problem is that the OGC SFS API is really focussed in
> operations on pairs of Geometrys, not collections.  Of course, there
> is the GeometryCollection class, which could provide this capability
> if the semantics of spatial operations were defined appropriately. 
> There weren't really any semantics specified for GeometryCollections
> in the SFS, and there were some tricky issues in handling GC's
> robustly, so we didn't pursue implementing the operations over GCs. 
> However, if we implemented the obvious union semantics for GCs for
> the spatial operations that would allow exposing an optimized "Union
> of many polygons" in a clean way.  (You would form a GC of all the
> polygons and then union it with the empty geometry.  Under the covers
> JTS would first union all the polygons in the GC).
> >
> > Any feedback on this issue of defining semantics for GCs is
> welcome. 
> >
> > Martin Davis, Senior Technical Architect
> > Vivid Solutions Inc.
> > Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
> > Phone: (250) 385 6040    Fax: (250) 385 6046
> > EMail: mbdavis@v...  Web: www.vividsolutions.com
> >
> >
> > > -----Original Message-----
> > > From: robmeek355 [mailto:register@r...]
> > > Sent: Sunday, June 22, 2003 6:44 AM
> > > To: jts_discussion@...
> > > Subject: [jts_discussion] Union of many polygons
> > >
> > >
> > > Hi there,
> > > I'm using JTS to perform unions on groups of 50-70 overlapping
> > > polygons in a java font editing experiment. The polygons
> themselves
> > > are relatively simple and most of the time JTS works great. I
> loop
> > > over all the polygons checking for intersections with all of the
> > > other polygons, and keep going till there are no more
> intersections.
> > > But this is all a bit slow. Is there a quicker/better/correct
> way?
> > > Can I collect all of the polygons into some kind of collection
> and
> > > then perform a single clipping operation on that -reducing the
> 50+
> > > polygons to a single or at least simplified set of shapes in one
> fell
> > > swoop?
> > > Thanks for any help,
> > > Rob Meek
> > >
> > >
> > > To unsubscribe from this group, send an email to:
> > > jts_discussion-unsubscribe@...
> > >
> > > 
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://ca.yahoo.com/docs/info/tos.html
> > >
> > >
> > >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> <http://ca.yahoo.com/docs/info/tos.html> Service.
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > jts_discussion-unsubscribe@...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> <http://ca.yahoo.com/docs/info/tos.html> Service.
>
>
> To unsubscribe from this group, send an email to:
> jts_discussion-unsubscribe@...
>

>
> Your use of Yahoo! Groups is subject to
> http://ca.yahoo.com/docs/info/tos.html
>
>
>

To unsubscribe from this group, send an email to:
jts_discussion-unsubscribe@...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

#362 From: José Ramón Mejía <jose_ramon_mejia@...>
Date: Mon Jul 21, 2003 1:16 pm
Subject: Re: Union of many polygons
jose_ramon_m...
Send Email Send Email
 
Great example!
Of course I'd like to see the code.

José Ramón

Messages 325 - 362 of 620   Oldest  |  < Older  |  Newer >  |  Newest
Messages 325 - 362 of 620   Oldest  |  < Older  |  Newer >  |  Newest
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help