0

I'm new to GEE. I'm trying to export a shapefile of Google building footprints cliped to a area of interest but I keep geting an error in the filterBounds.

This returns de message:

Error: Invalid property type: Property longitude_latitude has type Geometry. (Error code: 3)

Any thoughts of what could be happening?

//BUILDING FEATURE COLLECTION FOR MICROSOFT AND GOOGLE
var google_building = ee.FeatureCollection('GOOGLE/Research/open-buildings/v3/polygons');

//CLIP BUILDING WITH AOI
var google_clip=google_building.filterBounds(AOI)

//ADD BUILDING TO THE MAP
Map.addLayer(google_clip, {color: 'yellow'}, 'Google Buildings');

//SET MAP CENTER
Map.setCenter(18.42, -33.92, 14);

//EXPORT DATA TO GOOGLE DRIVE IN SHAPEFILE FORMAT
Export.table.toDrive({
  collection: google_clip,
  description: 'google_clip',
  folder: 'GEE',
  fileFormat:'SHP',
}); ```

1 Answer 1

0

The issue is that the longitude_latitude property cannot be encoded into a shapefile, because it is an object ({"type": Point, "coordinates":[lon,lat]}). The solution is to set it to null so that it gets dropped (or use selectors to not export it). If you still want to keep the coordinates, you can keep them as separate properties. Here's a demonstration of all this:

var test = ee.FeatureCollection('GOOGLE/Research/open-buildings/v3/polygons')
.filterBounds(AOI)
.map(function(f){
  var coords = ee.Geometry(f.get("longitude_latitude")).coordinates()
  return f.set({
    longitude: coords.get(0),
    latitude: coords.get(1),
    longitude_latitude:null,
  })
})

and here's a small live working demo: https://code.earthengine.google.com/d0923f9ae036891a78d3f8ba708f4805

1
  • That worked well!! Thank you!!
    – Gabriel_LB
    Sep 26, 2023 at 15:31

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.