0
일부 좌표를 geography 객체로 변환하려고합니다. 다음은 문제를 복제하는 간단한 테스트 도구입니다.왜 MS 지리학은이 폴리곤에 대해 불평하고 있습니까?
좌표가 시계 반대 방향으로 요구되는 MS 지리학 때문에 내가 가지고있는 지오 존즈가 무엇인지 잘 모르는 상태에서 좌표를 얻은 다음 내림차순으로 정렬 된 두 번째 세트를 준비합니다. 이것은 아니다/위도 오래 오래는/위도, 단지 1,2,3,4,5 5,4,3,2,1에에 :
DECLARE @MyPolygon geography
DECLARE @FwdCoords varchar(max) = 'POLYGON((-33.871090 150.823941, -33.878274 150.823941, -33.878274 150.831348, -33.871090 150.831348, -33.871090 150.823941))'
DECLARE @RevCoords varchar(max) = 'POLYGON((-33.871090 150.823941, -33.871090 150.831348, -33.878274 150.831348, -33.878274 150.823941, -33.871090 150.823941))'
BEGIN TRY
RAISERROR('Attempt to make polygon from forward string', 0, 1)
SET @MyPolygon = geography::STPolyFromText(@FwdCoords, 4326)
PRINT @MyPolygon.ToString()
END TRY
BEGIN CATCH
RAISERROR('Attempt failed. Try with reversed coordinates', 0, 1)
IF @@ERROR <> 0
BEGIN
PRINT 'Proc: ' + ERROR_PROCEDURE()
PRINT 'Line: ' + CONVERT(VARCHAR(10), ERROR_LINE())
PRINT 'Number: ' + CONVERT(VARCHAR(10), ERROR_NUMBER())
PRINT 'Message: ' + ERROR_MESSAGE()
END
BEGIN TRY
RAISERROR('Attempt to make polygon from reversed string', 0, 1)
SET @MyPolygon = geography::STPolyFromText(@RevCoords, 4326)
PRINT @MyPolygon.ToString()
END TRY
BEGIN CATCH
IF @@ERROR <> 0
BEGIN
PRINT 'Proc: ' + ERROR_PROCEDURE()
PRINT 'Line: ' + CONVERT(VARCHAR(10), ERROR_LINE())
PRINT 'Number: ' + CONVERT(VARCHAR(10), ERROR_NUMBER())
PRINT 'Message: ' + ERROR_MESSAGE()
END
END CATCH
END CATCH
나는 다음과 같은 오류
Line: 22
Number: 6522
Message: A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
System.FormatException:
at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.Validator.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.ForwardingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.CoordinateReversingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.OpenGisWktReader.ParseLineStringText()
at Microsoft.SqlServer.Types.OpenGisWktReader.ParsePolygonText()
at Microsoft.SqlServer.Types.OpenGisWktReader.ParseTaggedText(OpenGisType type)
at Microsoft.SqlServer.Types.OpenGisWktReader.Read(OpenGisType type, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
을받을
다각형은 정사각형입니다. 마지막 좌표는 첫 번째 좌표와 일치합니다. 좌표를 보면 그들은 모두 lat/lng이며, -90에서 90 사이의 값을 가지고 있습니다.
내가 볼 수있는 것에서는 유효하지 않은 라트 나 long에 문제가 없습니다. MS Geography가 내가 그렇게 믿는 이유는 무엇입니까?
> _ <너무 바보입니다. – Hecatonchires