I am having problems getting lengths from multilinestrings after transforming data from EPSG:27700 - OSGB 1936 / British National Grid to EPSG:4326/ WGS 84.
I'm doing this conversion to import a roads shapefile into a PostGIS database that uses WGS84 as default. However, when I try to calulate lengths, I'm having weird readings.
Firstly I thought about some incorrect transformation, but after doing some additional tests in an empty database importing the layer without transforming it (OSGB 1936 reference), I´m still puzzled:
The following query returns contradictory results
SELECT ST_Length(geom) AS length_OSGB ,ST_Length_Spheroid(ST_Transform(geom,4326),'SPHEROID["WGS 84",6378137,298.257223563]') As length_WGS84 FROM osgb36_data WHERE id = 108
this yields 338 meters for the OSGB36 length and 482 meters for the WGS84 length. The right one is 338 meters.
I've done the importation to the database using QGIS and DBmanager.
Also, I had to guess the initial projectios, as the .prj was missing, but projecting the result over google maps results in a perfect match.
Any hint is welcome
This is the WKT for the element in the example, as suggested:
SRID=27700;MULTILINESTRING(( 423216.279 574665.249 0, 423206.315 574708.077 44.649, 423158.458 574896.911 242.525, 423132.406 574993.061 344))
Well, that's weird, seems like they were using the z coordinate to register the accumulated distance for each point in the linestring... That could explain the issue with the wrong distances