1

I understand how to get the points that fall inside a polygon with GEE:

// Load a feature collection and a area of interest
var dataset1 = ee.FeatureCollection("link/to/any/point/dataset/on/gee");

// Define a region roughly covering the EU.
var eu = ee.Geometry.Rectangle(-26.367188,34.016242,35.332031,73.124945);
Map.addLayer(eu, {color: '000000'}, 'planar polygon');
Map.centerObject(eu);


// Filter the table geographically: only points in eu
var filtered = dataset1.filterBounds(eu);
print(filtered);
Map.addLayer(filtered, {}, 'default display');

How do I get all the points that are outside the polygon?

I've seen a topic here that discussed how to do this with polygons, but when implementing it, I don't get a featureCollection returned, but some weird data type like:

Filter.not
type:Filter.not
filter:Filter.intersects
type:Filter.intersects
leftField:.geo
maxError:ErrorMargin
rightValue:Polygon, 5 vertices

Assistance?

1
var filtered = dataset1.filter(ee.Filter.bounds(eu).not())
3
  • that seems like the right way of doing to me, but notwithstanding the fact that the points display when i do Map.addLayer, i cannot print the featureCollection to the console and inspect it (error - FeatureCollection (Error) The service is currently unavailable.) , nor can I export it (been trying to complete the export to drive for 13 hours). Which dataset does the code work for you with, if I may ask? – Momchill Feb 6 at 10:25
  • Thanks for your comment @Momchill. I tested the code on an arbitrary feature collection of polygons. I have not encoutnered that error message before, but I get the impression that it may not be related to the code (e.g. like run time-out messages). – korndog Feb 7 at 7:55
  • Are you able to share the code and tables that isn't working? – Noel Gorelick Feb 10 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.