I have a bunch of points in an SDE table which is currently stored in an MSSQL database.
The full entry is below, while the data i'm trying to convert from binary to geometry is: 0x0B000000000100008AA1D6D50F8DC091D80600
Inside the SQL table the data is stored as an 'image' datatype.
I'm chasing the correct way to convert this data into a geometry type so I can see its components.
I've tried 2 general methods methods, both have failed. I've now retiring as not knowing what i'm doing.. help?
declare @binary VARBINARY(MAX) = cast((select top 1 points
from networks.networks.f43) as varbinary(MAX))
declare @geo geometry = cast(@binary as geometry)
select convert(geometry,0x0B000000000100008AA1D6D50F8DC091D80600,0)
select cast(0x0B000000000100008AA1D6D50F8DC091D80600 as geometry)
These all return the same error, with an unexpected version??
A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.FormatException: 24210: Geometry type with an unexpected version of 0 received; only versions up to 2 are accepted. System.FormatException: at Microsoft.SqlServer.Types.GeoData.Read(BinaryReader r, SerializationVersion maxVersion, String strUnexpectedVersion, Boolean isGeography) at Microsoft.SqlServer.Types.SqlGeometry.Read(BinaryReader r) at SqlGeometry::.DeserializeValidate(IntPtr , Int32 , CClrLobContext* )
declare @g geometry = geometry::STGeomFromWKB(0x0B000000000100008AA1D6D50F8DC091D80600, 0);
Returns this error:
A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.FormatException: 24115: The well-known binary (WKB) input is not valid. System.FormatException: at Microsoft.SqlServer.Types.WellKnownBinaryReader.ParseWkb(OpenGisType type) at Microsoft.SqlServer.Types.WellKnownBinaryReader.Read(OpenGisType type, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromBinary(OpenGisType type, SqlBytes binary, Int32 srid)