Skip to main content
2 of 2
added gist and changed contains to intersects
Ian Turton
  • 83.2k
  • 6
  • 89
  • 189

There is no (good) reason to limit yourself to points, you can see if your buffer intersects with the countries directly:

public SimpleFeatureCollection lookup(Geometry g, SpatialIndexFeatureCollection countries) {
    GeometryFactory gf = new GeometryFactory();
    
    Filter f = ff.intersects(ff.property("the_geom"), ff.literal(g));
    ret = countries.subCollection(f);
    
    
    return ret;
}

Full gist

Ian Turton
  • 83.2k
  • 6
  • 89
  • 189