Based on the Pathhaka Risk solution, here is a SQL solution (Redshift) for calculating areas for GeoJSON multipolygons (assuming that line row 0 is the outermost polygon)
create or replace view geo_area_area as with points as ( select ga.id as key_geo_area , ga.name, gag.linestring , gag.position , radians(gag.longitude) as x , radians(gag.latitude) as y from geo_area ga join geo_area_geometry gag on (gag.key_geo_area = ga.id) ) , polygons as ( select key_geo_area, name, linestring, position , x , lag(x) over (partition by key_geo_area, linestring order by position) as prev_x , y , lag(y) over (partition by key_geo_area, linestring order by position) as prev_y from points ) , area_linestrings as ( select key_geo_area, name, linestring , abs( sum( (x - prev_x) * (2 + sin(y) + sin(prev_y)) ) ) * 6378137 * 6378137 / 2 / 10^6 as area_km_squared from polygons where position != 0 group by 1, 2, 3 ) select key_geo_area, name , sum(case when linestring = 0 then area_km_squared else -area_km_squared end) as area_km_squared from area_linestrings group by 1, 2 ;
source share