空间数据类型

时间:2012-03-29 17:11:46

标签: sql-server spatial

我想我找不到我的(明显愚蠢的)错误: - )。

关于数据库的SELECT语句:

SELECT geography::STMPolyFromText('MULTIPOLYGON( (((11.791039 47.5448077, 11.7910551 47.544757, 11.7911677 47.5446375, 11.7644687 47.542786))) )',4326)

错误是:

NET Framework error occurred during execution of user-defined routine or aggregate "geography": 
System.FormatException: 24141: A number is expected at position 26 of the input. The input has (11.791039.
System.FormatException: 
   at Microsoft.SqlServer.Types.WellKnownTextReader.RecognizeDouble()
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParseLineStringText()

找不到我的错误,也许有人看到错误了?!


刚刚找到解决方案:a'('太多了。

1 个答案:

答案 0 :(得分:1)

我认为在MULTIPOLYGON ... this example shows only 3之后你有一对太多的括号,但你有4对。

相反,请尝试:

SELECT geography::STMPolyFromText
(
    'MULTIPOLYGON
    ( 
        (
            (
                11.791039 47.5448077, 
                11.7910551 47.544757, 
                11.7911677 47.5446375, 
                11.7644687 47.542786
            )
        ) 
    )',4326
)