I managed to create my Polygon from arrays of x and y coordinates (doubles)
using the following code:
xArray = location.getCoordinateLists().get("X").toArray(xArray);
yArray = location.getCoordinateLists().get("Y").toArray(yArray);
GeometryFactory geometryFactory =
JTSFactoryFinder.getGeometryFactory(null);
Coordinate[] coordinates = new Coordinate[xArray.length + 1];
for (int i=0; i < xArray.length; i++) {
coordinates[i] = new Coordinate(xArray[i], yArray[i]);
}
coordinates[xArray.length - 1] = new Coordinate(xArray[0],
yArray[0]);
LinearRing lr = geometryFactory.createLinearRing(coordinates);
Polygon polygon = geometryFactory.createPolygon(lr, null);
However, I now have a list of Feature objects with a latitude and longitude
that I need to check if is inside the polygon. I had assumed, incorrectly,
that I could do it with the Polygon contains() method.
I don't know anything about filters or expressions, and am asking for any
assistance anyone can give me.
Jason
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users