无法在SSMS中查看地理数据(空间结果标签)

时间:2015-07-17 18:14:18

标签: sql-server tsql sql-server-2012 spatial

此:

DECLARE @g GEOMETRY

SET @g = GEOMETRY::STPolyFromText('POLYGON((-3.19133 57.12592, -3.20621 57.12339, -3.24347 57.11936, -3.28312 57.10994, -3.34619 57.10951, -3.36079 57.11114, -3.3713 57.11414, -3.31958 57.17965, -3.2243 57.22291, -3.22278 57.22303, -3.21168 57.22427, -3.20742 57.22845, -3.16721 57.27598, -3.15209 57.29011, -3.14448 57.29477, -3.14382 57.29464, -3.03228 57.28542, -3.01872 57.28257, -3.01236 57.2823, -2.99083 57.2772, -2.99133 57.24862, -2.9881 57.24493, -2.97908 57.22876, -2.9676 57.22416, -2.96754 57.22275, -2.98005 57.20513, -2.97461 57.20236, -2.96718 57.20133, -2.96686 57.20082, -2.95002 57.18476, -2.94752 57.17462, -2.95713 57.17252, -2.97368 57.16715, -2.98438 57.15701, -2.98449 57.15695, -2.98529 57.15668, -3.0318 57.14936, -3.06189 57.12386, -3.07636 57.12476, -3.07786 57.12499, -3.09228 57.12804, -3.12085 57.13076, -3.12753 57.12961, -3.19133 57.12592))', 4326);

SELECT @g

允许我在SSMS(空间结果选项卡)中查看结果。但是,当我使用GEOGRAPHY时:

DECLARE @g GEOGRAPHY

SET @g = GEOGRAPHY::STPolyFromText('POLYGON((-3.19133 57.12592, -3.20621 57.12339, -3.24347 57.11936, -3.28312 57.10994, -3.34619 57.10951, -3.36079 57.11114, -3.3713 57.11414, -3.31958 57.17965, -3.2243 57.22291, -3.22278 57.22303, -3.21168 57.22427, -3.20742 57.22845, -3.16721 57.27598, -3.15209 57.29011, -3.14448 57.29477, -3.14382 57.29464, -3.03228 57.28542, -3.01872 57.28257, -3.01236 57.2823, -2.99083 57.2772, -2.99133 57.24862, -2.9881 57.24493, -2.97908 57.22876, -2.9676 57.22416, -2.96754 57.22275, -2.98005 57.20513, -2.97461 57.20236, -2.96718 57.20133, -2.96686 57.20082, -2.95002 57.18476, -2.94752 57.17462, -2.95713 57.17252, -2.97368 57.16715, -2.98438 57.15701, -2.98449 57.15695, -2.98529 57.15668, -3.0318 57.14936, -3.06189 57.12386, -3.07636 57.12476, -3.07786 57.12499, -3.09228 57.12804, -3.12085 57.13076, -3.12753 57.12961, -3.19133 57.12592))', 4326);

SELECT @g

我无法在SSMS(空间结果标签)中查看结果。这是正常行为,还是我的语法有问题,不会产生任何错误。

PS:

由于this而无效。

2 个答案:

答案 0 :(得分:3)

我无法查看我的地理多边形,因为这些点使用了顺时针顺序!请参阅this链接。

答案 1 :(得分:0)

不,那不是"正常"行为。您应该能够在“空间结果”选项卡中查看“地理”和“几何”结果。我在我当地的SSMS 2012中尝试了两种查询,它们运行良好。

您是否可以确保在查询窗口中右键单击并且"结果为 - >格"选择?