Skip to main content
added gist and changed contains to intersects
Source Link
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.containsintersects(ff.property("the_geom"), ff.literal(g));
    ret = countries.subCollection(f);
    
    
    return ret;
}

Full gist

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.contains(ff.property("the_geom"), ff.literal(g));
    ret = countries.subCollection(f);
    
    
    return ret;
}

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

Source Link
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.contains(ff.property("the_geom"), ff.literal(g));
    ret = countries.subCollection(f);
    
    
    return ret;
}