SQL 地理数据类型,它包含的乱码如何使用?

SQL Geography data type, how to use the gibberish it contains?

我正在查看 sql 地理数据类型,它似乎不是很直观,我只是没有找到很多关于它的好(或者更确切地说 "easy to understand")信息.例如(取自 'partially' 我发现很少谈论它的网站):

INSERT INTO [dbo].[visitorLocationInfo](id, test)
VALUES(3, 
  geography::STPointFromText('POINT(55.9523783996701 -3.2051030639559)', 4326)
);

我知道第一个是纬度,第二个是经度,但是 (4326) 的第三个值是多少?我应该如何处理它输入的结果???

id  latitude    longitude   zip     city    state   country test
3   NULL        NULL        NULL    NULL    NULL    NULL    0xE6100000010CF9FF3F130DA409C0FDFF0F89E7F94B40

那个长数字不是很可读...

也许我只需要有人花 5 分钟给我五分钱之旅?

我对此不熟悉,但是 it seems you can call ToString 在列中获取文本表示形式:

select test.ToString()
from   tableName

地理数据类型作为 CLR 类型实现。这意味着它就像来自编程世界的对象。因此,您可以对其调用 all sorts of methods。您看到的是对象的十六进制表示形式。

在回答您有关距离等问题时,您是对的。如果您有一个包含地理类型列的 table,您可以执行以下操作:

declare @g geography = 
    geography::STPointFromText(
      'POINT(55.9523783996701 -3.2051030639559)', 4326
    ).STBuffer(5);

select *
from dbo.yourTable
where gCol.STIntersects(@g) = 1

也就是说 "get me all of the rows in dbo.yourTable where the some part of the geography object contained in the column gCol is within 5 meters of 55.9523783996701 -3.2051030639559"。