I have spatialite geometry data stored in a spatialite database in WGS 84 (EPSG 4328) format:

    SELECT Srid(geometry) FROM shape_layer;
    > 4326

When geometry is being returned as text, it is returned in meters (when the data is being worked on, the projection is more commonly EPSG 3857 to make use of Google Maps/OpenStreetMap). By example:

    SELECT AsText(geometry) FROM shape_layer;
    > LINESTRING(-381578.202 6574042, -378511.828 6574794.956)

All data works will display correctly (e.g. if using QGIS), but this is giving me issues when using spatial queries. GLength returns a non-projected length (3.16km) rather than the actual (Ellipsoidal) length (2km). I'm assuming I'm going to have similar issues with area.

QGIS can do this simply by checking the Ellipsoid option for measuring length/area so I know its possible with the data I have. But how can I get the actual values for length and area from this data using spatialite?

I'm hoping this is a pretty simple thing to resolve. Thanks in advance for any help you can provide!