Bug #71869 Unable to read geometry column when it has been set with a SRID value.
Submitted: 27 Feb 2014 17:36 Modified: 16 Jul 2014 23:23
Reporter: Sam Kelleher Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.8.3 OS:Windows (MySql 5.6, EF 6.0.2)
Assigned to: Francisco Alberto Tirado Zavala CPU Architecture:Any
Tags: geospatial, gis

[27 Feb 2014 17:36] Sam Kelleher
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.
[16 Jul 2014 23:23] Philip Olson
Fixed as of the upcoming Connector/Net 6.9.2 RC release, and here's the changelog entry:

Creating a Geometry Column with an SRID value would not save the value to
the table.

Thank you for the bug report.