coordinate-system – Changing Projection in Google Earth Engine for Accurate Area Calculation

coordinate systemgoogle-earth-enginegoogle-earth-engine-javascript-api

I'm having trouble to change the projection using the GEE.

I have the following code:

var countries = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level0");
var belgium = countries.filter(ee.Filter.eq('ADM0_NAME', 'Belgium'));
print(belgium)  // Belgium is a Feature Collection
Map.addLayer(belgium);
Map.centerObject(belgium);

Then I calculate its area under the default reference system (WGS84):

var areaBelgium = belgium.geometry().area().divide(1e6).round();
print('Area in WGS84 (km2) - WGS84 - EPSG 4326:', areaBelgium);

I've been trying to do the same area calculation but using a Projected Coordinate System instead (Lambert EPSG:31370). For that goal, I've been using .transform() and .map(). Nonetheless, I don't get any results:

var lambert = ee.Projection('EPSG:31370');

// Define a function to apply the projection to each feature
var transformLambert = function(feature) {
  return feature.transform(lambert);
};

// Map the transform function to the Feature Collection
var belgiumLambert = belgium.map(transformLambert);

var areaBelgiumLambert = belgiumLambert.geometry().area().divide(1e6).round();
print('Area in EPSG 31370 - Lambert:', areaBelgiumLambert);

I would like to calculate the area in Lambert EPSG 31370.
Does anybody know what's wrong with this reprojection?

Best Answer

You have a mis-conception about coordinate reference systems.

The CRS doesn't (and can't) have any effect on vector-based area calculations. Translation of the coordinates into another reference system doesn't move them; they're in the same place on the sphere, so the area will be identical (to within the specified error margin).

As the error you're hitting says: "Please specify a non-zero error margin.", you haven't specified an error margin to the transform and area functions. A value of 1 will work just fine.

(Note, if you're doing raster-based area computations, that's a whole different thing).

Related Question