// -- Distance calculation using GEOGRAPHY (122.2km)
// SELECT ST_Distance('LINESTRING(-122.33 47.606, 0.0 51.5)'::geography, 'POINT(-21.96
// 64.15)':: geography);
// adding Reykjavik
FeatureWriter fw = dataStore.getFeatureWriterAppend(tname("geopoint"),
Transaction.AUTO_COMMIT);
SimpleFeature f = (SimpleFeature) fw.next();
Point point = gf.createPoint(new Coordinate(-21.96, 64.15));
f.setAttribute("name", "Reykjavik");
f.setDefaultGeometry(point);
fw.write();
fw.close();
// testing distance filter
LineString line = gf.createLineString(new Coordinate[] { new Coordinate(-122.33, 47.606),
new Coordinate(0.0, 51.5) });
DWithin filter = ff.dwithin(ff.property(aname("geo")), ff.literal(line), 130000d, "metre");