1

I'm new to Google Engine, I have two shapefiles, one is named Deforestation with almost 600,000 polygons inside of the shapefile, and the second one is named Aliso which is a geometry that only is one polygon. I tried to intersect Deforestation with Aliso using the next function:

Var Areaintersect = Deforestation.intersection(Aliso);

enter image description here

But when I tried to do the process I got a error message: Line 2: Deforestacion_Corregida.intersection is not a function

How could I solve this error message and get the intersection between this two assets

You can see the project in the next link https://code.earthengine.google.com/d4078a337b16f7c551d8e22ff937ca94

1
  • It's hard to tell without having access to the files themselves, but it looks like you may have to do an explicit cast i.e. ee.FeatureCollection(Aliso) or ee.Geometry(Aliso) or ee.Feature(Aliso) depending on your file. You may also need to calculate the geometry using .geometry() before intersecting.
    – M. Nicolas
    Commented Feb 28, 2023 at 15:48

1 Answer 1

0

The intersection of those geometries is the null set. Here's how to find out (link):

Map.addLayer(Aliso, {color: 'red'})
Map.addLayer(Deforestacion)
var filtered = Deforestacion.filterBounds(Aliso)
print(filtered.size()) // 0

In general, don't call .geometry() on a very big collection. It will try to load all of the geometries into memory at once. Instead, use a filterBounds() or a spatial join to find all the features in one collection that intersect those in another.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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