public void TestSTLengthSpheroid() { using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString)) { const string Spheroid = "SPHEROID[\"GRS_1980\",6378137,298.257222101]"; const string Wkt = "MULTILINESTRING((-118.584 38.374,-118.583 38.5), (-71.05957 42.3589, -71.061 43))"; var geom1 = db.Select(() => GeometryInput.STGeomFromText(Wkt)); var length1 = db.Select(() => MeasurementFunctions.STLengthSpheroid(geom1, Spheroid)); Assert.AreEqual(85204.5207711811, length1.Value, 1.0E-9); var length2 = db.Select(() => MeasurementFunctions.STLengthSpheroid(geom1.STGeometryN(1), Spheroid)); Assert.AreEqual(13986.8725282447, length2.Value, 1.0E-9); var length3 = db.Select(() => MeasurementFunctions.STLengthSpheroid(geom1.STGeometryN(2), Spheroid)); Assert.AreEqual(71217.6482429363, length3.Value, 1.0E-9); Assert.AreEqual( 85204.5207711811, db.Select(() => MeasurementFunctions.STLengthSpheroid(Wkt, Spheroid)).Value, 1.0E-9); Assert.IsNull(db.Select(() => MeasurementFunctions.STLengthSpheroid((NTSG)null, Spheroid))); } }