SQL의 geography 필드에 C# asp를 사용하여 데이터를 추가하려고합니다. 그물.SQL에서 geography 데이터 형식 저장
POINt 또는 LINESTRING을 추가 할 때 오류는 없지만 POLYGON을 추가 할 때 다음 오류가 발생합니다.
Message: [DataConnection.HandleError]: Query: Proc_CSA_AssetUpdateLocation: caused exception: 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)
at Microsoft.SqlServer.Types.SqlGeography.Parse(SqlString s)
나는 통과하는 데이터가 (예를 들어)입니다.
POLYGON((54.40854093377361 -6.197662353515625, 54.422126065167866 -6.212425231933594, 54.43011521616425 -6.164703369140625, 54.41093863702367 -6.128997802734375, 54.40094728183984 -6.150970458984375, 54.40854093377361 -6.197662353515625))
저장된 프로 시저 : 나는 내 데이터의 오류에 대한 이유를 찾을 수 없습니다 보면
@Name nvarchar(20),
@ModifiedWhen DateTime,
@itemGUID UniqueIdentifier,
@GeoLocs nvarchar(max),
@Type int
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.csa_AssetGeoData
Set ItemModifiedWhen = @ModifiedWhen,GeoCord = @GeoLocs,GeographyTypeItemID = @Type, Name = @Name
WHERE ItemGUID = @itemGUID
불행하게도 상관없이.
제 질문은이 오류의 원인 일 수 있습니다.
필요한 경우 더 많은 정보를 제공 할 수 있습니다. 너무 모호한 경우 미안합니다 (정보가 없음).
나는 그것을 시도했지만 형상이 지리가 아니며 SQL에서 오류가 발생합니다. 피연산자 유형 충돌 : sys.geometry가 sys.geography와 호환되지 않습니다. – Spitfire2k6
사실 'geography' 유형의 열에'nvarchar (max)'값을 할당하면 실패하고 throw되는 구문 분석이 발생합니다. 그것은 예외 스택이 말하는 것입니다. –
내가 너무 생각하지만 모두 : POINT (-6.261348724365234 53.351268586147086) 과 : LINE (53.74221377343109 -8.3221435546875, 53.02139221293762 -8.0804443359375, 53.77468884583564 -7.6190185546875, 53.40298249424814 -6.8719482421875, 54.0335863352108 -7.2015380859375) 잘 동작! – Spitfire2k6