> Hi Jody, > Yes, I have looked at the wiki! The wiki only mentions the "touches" > relationship. It doesn't show you how to extract this "touches" property in > the shapefile.
You need to look at the Geometry class to sort out the different relationships. touches is a method on the geometry class (ie Polygon). > So, I need to know how to find out from a shapefile if two > polygons are touching. This is the question that I am trying to answer. Thinking - are you talking the graph module here (that is do you want to build a network) or are you just trying to find matches? You may wish to use a for loop and go through the shapefile multiple times; - it take one polygon out ,,, - use it to query the shapefile a second time to find other polygons that touch - continue ... Reading: - http://docs.codehaus.org/display/GEOTDOC/06+FeatureSource - http://docs.codehaus.org/display/GEOTDOC/12+Using+a+Loop+to+Join+FeatureCollections > Another question, what is the difference between a 4 points ploygon and a 5? > > Polygon p1 = createPolygon("0 0,1 1,2 2,0 0");// 4 points > Polygon p2 = createPolygon("0 0,5 0,5 5,0 5,0 0"); // 5 points Not sure I understand they are two different polygons... For background reading on how geometry comparisons are performed: - http://docs.codehaus.org/display/GEOTDOC/03+JTS+Topology+Suite - http://docs.codehaus.org/display/GEOTDOC/Point+Set+Theory+and+the+DE-9IM+Matrix ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
