Description:
Error:
24114: The label SRID=4326;POINT(51.5 in the input well-known text (WKT) is not valid. Valid labels are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and FULLGLOBE (geography Data Type only).
Stack:
[FormatException: 24114: The label SRID=4326;POINT(51.5 in the input well-known text (WKT) is not valid. Valid labels are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and FULLGLOBE (geography Data Type only).]
Microsoft.SqlServer.Types.OpenGisTypes.ParseLabel(String input) +326
Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type) +99
Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid) +47
Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid) +485
Microsoft.SqlServer.Types.SqlGeometry.Parse(SqlString s) +222
How to repeat:
Create a geometry column in a table, and write to it using either TSQL, or generate the data in C#:
object.geo = DbGeometry.FromText(string.Format("POINT({0} {1})", 51.5 /* LON /*, -1.28 /* LAT * /), 4326)
or
UPDATE table SET geo = GeomFromText(CONCAT('POINT(',lon,' ',lat,')'),4326);
Next, read that data back out again.
The C# class has a DbGeometry property (named geo in this example)
Suggested fix:
If SRID is omitted when saving the value, the connector works, but then the units calculated for distance are 'unreliable', as in, there is no documentation to indicate what units they are, and they don't match up when known distances are compared.