SQL Server 2008 Geography .STBuffer() 距离测量单位

发布于 2024-09-03 19:00:55 字数 341 浏览 17 评论 0原文

我正在使用纬度/经度处理一个地理点,并且需要在我们的数据库中查找该点 5 英里半径内的其他点。但是,我似乎无法找出 STBuffer 的“单位”是什么,它似乎不符合英尺、英里、米、公里等。文档仅将它们称为“单位”,任何建议?感谢

来自 geography::STGeomFromText('POINT(xy)', 4326).STBuffer(z).STIntersects(geography::STGeomFromText('POINT(' + CAST(v.Longitude as varchar(max))) 的 [...] + ' ' + CAST(v.Latitude as varchar(max)) + ')', 4326)) = 1

I'm working with a geographic point using lat/long and need to find other points in our database within a 5 mile radius of that point. However, I can't seem to find out what the "units" are for STBuffer, it doesn't seem to conform to feet, miles, meters, kilometers, etc. The documentation only refers to them as "units", any suggestions? Thanks

[...] from geography::STGeomFromText('POINT(x y)', 4326).STBuffer(z).STIntersects(geography::STGeomFromText('POINT(' + CAST(v.Longitude as varchar(max)) + ' ' + CAST(v.Latitude as varchar(max)) + ')', 4326)) = 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

耳根太软 2024-09-10 19:00:55

测量单位取决于所使用的空间参考系统。有关详细信息,请参阅此系统视图:

SELECT * FROM sys.spatial_reference_systems;

The unit of measurement depends on the spatial reference system in use. See this system view for details:

SELECT * FROM sys.spatial_reference_systems;

不乱于心 2024-09-10 19:00:55

STBuffer 以米为单位。 更多信息请参见此处。

要将英里转换为米,请除以英里数英里乘 0.0006213712

(即 5 英里 / 0.0006213712 = 8,046.72 米)

STBuffer is in meters. More info here.

To convert, miles to meters, divide the number of miles by 0.0006213712

(i.e. 5 miles / 0.0006213712 = 8,046.72 meters)

烧了回忆取暖 2024-09-10 19:00:55

对于访问此页面的任何人来说,如果他们对为什么缓冲距离可能不以米为单位感到困惑,这可能是因为您使用的是几何数据类型而不是地理数据类型。就我而言,很明显,地理以米为单位,而几何则不然(看起来是度数?),即使为几何正确设置了空间参考系统。

要将纬度和经度转换为地理点:

geography::Point(latitude, longitude, 4326) -- 4326 is WGS-84 EPSG Projection

For anyone visiting this page who is confused by why their buffer distances may not be appearing in meters, it may be because you are using the geometry data type versus the geography data type. In my case, it was clear that geography operates with meters, while geometry does not (degrees it appears?) even if the spatial reference system is set correctly for geometry.

To convert latitude and longitude to a geography point:

geography::Point(latitude, longitude, 4326) -- 4326 is WGS-84 EPSG Projection
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文