Martin, Thank you for your rapid reply.
I wasn't sure how to provide you with the java.awt.Shape instances that I am using. So, I tried creating geometries from shapefiles using your JUMP toolkit, and the resulting geometries intersected just fine. Can you guide me towards where in the JUMP code, or towards a document, that tells how to go from a jts.geom.Geometry to a java.awt.Shape? Thanks again! By the way, with my original Shape instances, I tried using intersects(), and got the following stack trace. I am including this just in case you are familiar with this class of error: Exception in thread "main" com.vividsolutions.jts.geom.TopologyException: side location conflict [ (-70.82511138916016, 42.260406494140625, NaN) ] at com.vividsolutions.jts.geomgraph.EdgeEndStar.propagateSideLabels(EdgeEndStar.java:297) at com.vividsolutions.jts.geomgraph.EdgeEndStar.computeLabelling(EdgeEndStar.java:138) at com.vividsolutions.jts.operation.relate.RelateComputer.labelNodeEdges(RelateComputer.java:297) at com.vividsolutions.jts.operation.relate.RelateComputer.computeIM(RelateComputer.java:132) at com.vividsolutions.jts.operation.relate.RelateOp.getIntersectionMatrix(RelateOp.java:130) at com.vividsolutions.jts.operation.relate.RelateOp.relate(RelateOp.java:75) at com.vividsolutions.jts.geom.Geometry.relate(Geometry.java:908) at com.vividsolutions.jts.geom.Geometry.intersects(Geometry.java:684) at edu.psu.geovista.jts.SpatialWeights.useIntersects(SpatialWeights.java:259) at edu.psu.geovista.jts.SpatialWeights.main(SpatialWeights.java:292) regards, -Frank On 5/30/07, Martin Davis <[EMAIL PROTECTED]> wrote:
Why not just use the intersects() method on your constructed Geometrys? Otherwise, I'd need some runnable code to test this. You could also provide the exception stack trace. Frank Hardisty wrote: > Dear Martin and All, > > I have been trying to create multipolygons from java.awt.GeneralPath > objects. I want to use JTS in order to find out which shapes touch > which ones, and to find their centroids. I am using the 1.8 release. > However, I get NullPointerExceptions, and I can't understand why. So, > if Martin or someone else could help me understand where I have gone > wrong, in either my general approach, or the specifics of my code, I > would appreciate it. > > I have been using the JTS JavaDocs and the 1.4 developers' guide. I > could not find a way to search the current discussion archives, is > there a way to do this? > > My approach is as follows > > 1. turn x,y values into Coordinate[] > 2. turn Coordinate[] into LinerRing[] > 3. turn LineString[] into Polygon[] > 4. turn Polygon[] into MultiPolygon > 5. two ideas here: use the computeEdgeIntersections method of > SegmentIntersector, or use a RelateComputer to find if two > MultiPolyons touch. > > However, using either approach listed in 5, I get > NullPointerExceptions. Help! > > I'll paste in my code below. > > thanks again, > -Frank > > > -- Martin Davis Senior Technical Architect Refractions Research, Inc. (250) 383-3022 _______________________________________________ jts-devel mailing list jts-devel@lists.jump-project.org http://lists.refractions.net/mailman/listinfo/jts-devel
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Frank Hardisty [EMAIL PROTECTED] GeoVISTA Center 210 Walker Building Dutton e-Education Institute 415 Earth and Engineering Sciences Building 814-867-1471 http://www.geovista.psu.edu/index.jsp _______________________________________________ jts-devel mailing list jts-devel@lists.jump-project.org http://lists.refractions.net/mailman/listinfo/jts-devel