JTS uses the half-line intersection method: com.vividsolutions.jts.algorithm.RayCrossingCounter
--adrian On Thu, 2008-07-24 at 10:30 +0100, Christian Weaves wrote: > Hi there, a noobie question if you don't mind, I have spent some time > reading the faq's but couldn't find the answer... > > Say I have a polygon and a point, is there a way of determining if the > point falls within the bounds of the polygon boundaries? > > Thank you v.much! > > Here's what I have so far: > > GeometryFactory geomFac = new GeometryFactory(); > > //create polygon > Coordinate[] polygonCoordinates = new Coordinate[10]; > polygonCoordinates[0] = new Coordinate(7,7); > polygonCoordinates[1] = new Coordinate(6,9); > polygonCoordinates[2] = new Coordinate(6,11); > polygonCoordinates[3] = new Coordinate(7,12); > polygonCoordinates[7] = new Coordinate(13,9); > polygonCoordinates[8] = new Coordinate(11,7); > polygonCoordinates[9] = new Coordinate(7,7); > > LinearRing ring = geomFac.createLinearRing(polygonCoordinates); > Polygon polygon = geomFac.createPolygon(ring,null); > > > //create point > Coordinate c = new Coordinate(14.0d,14.0d); > Point point = geomFac.createPoint(c); > > //code to check if point falls within polygon!? > > > > > --- > > Fugro Data Solutions Limited > Tyn y Coed > Llanrhos > Llandudno > North Wales > LL30 1SA > United Kingdom > > Tel: +44 (0)1492 563555 > Fax: +44 (0)1492 592030 > > General Email: [EMAIL PROTECTED] > > Website: www.fugro-data.com > > This email and any attachments are confidential. They may > contain privileged information and are intended for the named > addressee(s) only. They must not be distributed without our > consent. If you are not the intended recipient, please notify us > immediately and do not disclose, distribute, or retain this > email or any part of it. Unless expressly stated, opinions in > this email are those of the individual sender, and not of Fugro > Data Solutions Ltd. We believe but do not warrant that this > e-mail and any attachments are virus free. You must therefore > take full responsibility for virus checking. Fugro Data > Solutions Ltd and its subsidiaries may monitor email traffic > data and also the content of email for the purposes of security. > This email is not intended to create legal relations. > > Fugro Data Solutions Limited is a limited company registered in > England and Wales (Reg No. 5583527) at Tyn y Coed, Pentywyn Road, > Llanrhos, Llandudno, LL30 1SA. VAT No. GB901440962. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
