Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Polygon Intersection

Hi Andy,
you will first have to put them into a featurecollection and then you
should be able to go straight with this example:

http://svn.geotools.org/udig/trunk/tutorials/net.refractions.udig.code.examples/src/net/refractions/udig/code/examples/CreateTemporaryLayer.java

Ciao
Andrea


On Mon, 20 Aug 2007 15:33:22 +0100 "Andy Cox" <ivyavenue@xxxxxxxxxxx>
probably wrote:

> Hello,
> 
> I have a MultiPolygon layer and I want to return the intersection
> between two features and then create a new layer from it. So far I
> have:
> 
> featureIterator1 = featureStore.getFeatures(filter1).features();
> featureIterator2 = featureStore.getFeatures(filter2).features();
> 
> Feature feature1 = featureIterator1.next();
> Feature feature2 = featureIterator2.next();       
> 	        	        
> MultiPolygon poly1 = (MultiPolygon)feature1.getDefaultGeometry();
> MultiPolygon poly2 = (MultiPolygon)feature2.getDefaultGeometry();
> 
> doesOverlap = poly1.intersects(poly2);
> 			
> if (doesOverlap) {
> 				
> 	Geometry poly3 = poly1.intersection(poly2);
> }
> 
> featureIterator1.close();
> featureIterator2.close();
> 
> This returns the intersection geometry, how do I now create a new
> layer to view it?
> 
> Thanks
> Andy
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel


Back to the top