I work with a SQL Server 2008 R2 and I need convert one column Multipoint to Line. I tried various geographic features, but without success...
For example:
declare @f varchar(max);
declare @g geography;
set @f = (SELECT replace((SUBSTRING(T.ROUTEM.ToString(),11,9999999)),'(','' )
FROM dbo.TRAVELS T WHERE T.ID_TRAVEL = 74063);
set @f = (SELECT replace(@f,')', ''));
set @f = (SELECT 'LINESTRING (' + @f + ')');
set @g = geography::STLineFromText(@f,4326);
select @g;
The return from SQL Server is:
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.ArgumentException: 24200: The specified input does not represent a valid geography instance.
System.ArgumentException:
at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeoData g, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)*
If someone help me, I would be grateful.
PS: Is there a limit of points for the STLineFromText?