几何列:STGeomFromText和SRID(什么是SRID?) [英] Geometry column: STGeomFromText and SRID (what is an SRID?)

查看:809
本文介绍了几何列:STGeomFromText和SRID(什么是SRID?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩SQL Server 2008中的新地理栏和STGeomFromText函数。这是我的代码(适用于AdventureWorks2008)

  DECLARE @region geography; 
set @region = geography :: STGeomFromText('POLYGON((
-80.0 50.0,-90.0 50.0,
-90.0 25.0,-80.0 25.0,
-80.0 50.0)) ',4326);

SELECT @region;

我的问题是关于代码中的4326。它应该是一个空间参考ID。当我去MSDN时,它没有太多。如果我将该值更改为56,则会收到一个错误,告诉我该值必须位于sys.spatial_reference_systems表中。



您可以通过执行以下命令来查看该表:

  select * from sys.spatial_reference_systems 

该表中有一个well_known_text列,但它没有告诉我很多。 4326的值是:

$ $ $ $ $ $ $ $ $ $ $ c $ GEOGCS [WGS 84,DATUM [世界大地测量系统1984,ELLIPSOID [WGS PRIMEM [Greenwich,0],UNIT [Degree,0.0174532925199433]]

任何人都可以向我解释这个秘密吗?什么是SRID?

因此,我最终与一位前军事家伙谈话,他是一名雷达/制图专家。
基本上,他确切知道这个数字(4326)是什么,它来自哪里以及它为什么在那里。

这是计算地理学的行业标准。问题是地球不是一个完美的球体(它在中间膨胀),SRID 4326解释了这一点。

正如我所说的,表sys.spatial_reference_systems列出了所有的代码和它们是什么。但简短的版本是,你真的只会使用4326,除非你有一个非常具体的理由来使用不同的东西。


I'm playing with the new geography column in SQL Server 2008 and the STGeomFromText function. Here is my code (works with AdventureWorks2008)

DECLARE @region geography;
set @region = geography::STGeomFromText('POLYGON((
        -80.0 50.0, -90.0 50.0,
        -90.0 25.0, -80.0 25.0,
        -80.0 50.0))', 4326);

SELECT @region;

My question is about the 4326 in the code. It is supposed to be a spacial Reference ID. When I go to MSDN there isn't a lot on it. If I change the value to 56 I get an error telling me the value must be in the sys.spatial_reference_systems table.

You can look at that table by executing:

select * from sys.spatial_reference_systems 

There is a well_known_text column in that table, but it doesn't tell me much. The value for 4326 is:

GEOGCS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]]

Can anyone explain this mystery to me? What is the SRID?

解决方案

So I ended up talking with an ex-military guy yesterday who was a radar/mapping specialist. Basically, he knew exactly what that number (4326) was, where it came from, and why it is there.

It is an industry standard for computing geography. The problem is that the earth is not a perfect sphere (it bulges in the middle), and SRID 4326 accounts for that.

As I stated, the table sys.spatial_reference_systems lists all of the code and what they are. But the short version is that you are really only going to use 4326 unless you have a very specific reason to use something different.

这篇关于几何列:STGeomFromText和SRID(什么是SRID?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆