Hi Sorry Ted, this does not address your questions about the different geometries, but thought to make a couple of points: 1. For JTS contains it clearly states (in the link Jody provided), that the test is that the geometry is within the boundary of the other geometry and that it regards any point on the boundary to mean the geomerty is not contained. 2. If precision is very important and you are for instance dealing with small differences in coordinates represented by large numbers, you may have issues due to inaccuracy. I think the JTS implementation relies on a precision model that cannot guarantee an accurate result in all cases.
Best wishes, Andy http://www.geog.leeds.ac.uk/people/a.turner/ ________________________________ From: Ted Yu [[email protected]] Sent: 10 July 2011 23:50 To: Jody Garnett Cc: geotools-gt2-users Subject: Re: [Geotools-gt2-users] judging whether a point is inside a Geometry What I plan to do is to check whether any of 100K locations is outside a group of geometries. DirectPosition is not Geometry. So I must resort to MultiPoint which actually only contains one point ? Also, I downloaded geotools which doesn't contain IndexedPointInAreaLocator or PreparedGeometryFactory Do I have to resort to vividsolutions' distribution ? Thanks On Sun, Jul 10, 2011 at 3:31 PM, Jody Garnett <[email protected]<mailto:[email protected]>> wrote: Contains or within - http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#contains(com.vividsolutions.jts.geom.Geometry)<http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#contains%28com.vividsolutions.jts.geom.Geometry%29> If you have a bunch to test use a prepared geometry for speed (so it does not have to recreate the edge graph each time). For a discussion see here: - http://docs.geotools.org/latest/userguide/library/jts/dim9.html#preparedgeometry Also there *just* point in polygon you can use the class directly: - IndexedPointInAreaLocator<http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/algorithm/locate/IndexedPointInAreaLocator.html> Also note that the same relationship (ie contains) can be used with a GeoTools Query when asking for polygons from a feature source. See the "Use a point for to Check Polygon Layers" example here: - http://docs.geotools.org/latest/userguide/library/main/filter.html (it includes pictures of what is going on) -- Jody Garnett On Monday, 11 July 2011 at 7:07 AM, Ted Yu wrote: I went over the methods in Geometry interface and didn't find a method which can tell whether a point is inside a Geometry. How can I do that ? Thanks ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Geotools-gt2-users mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
