Yes, there is a way.
First, create a JTS polygon object :
// Creates the geometry factory
GeometryFactory factory = JTSFactoryFinder.getGeometryFactory(null);
// Here is your line string
LineString lineString = YOUR_LINESTRING;
// Creates a linear ring from the linestring (that has to be closed)
LinearRing shell =
factory.createLinearRing(lineString.getCoordinates());
// Creates the polygon
Polygon polygonA = factory.createPolygon(shell, new LinearRing[0]);
// Compares the polygons
boolean toto = polygonA.contains(polygonB);
Le 28 avr. 09 à 16:04, Mike Huber a écrit :
Hi Everyone
I have a question about geotools. Is there a Way to determine if a
Polygone A contains a Polygone B?
For example.
Polygone A with LineStirng (1 1, 2 3, 4 5, 1 1)
Paygone B which would be inside Polygone A
Now is there a Way to find out, if Poylgone B is inside Polygone A ?
Thanks for an anwser
Mike
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code
vel09scf
and Save an extra 15% before 5/3.
http://p.sf.net/sfu/velocityconf_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Benoît Thiébault
Société Artenum
24 rue Louis Blanc, 75010 Paris
tel: +33 (0)1 46 94 67 54
Artenum - Science & Groupware - http://www.artenum.com
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users