本文介绍了SQL Server 2008地理.STBuffer()距离测量单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用经/纬度来处理地理点,因此需要在我们数据库的半径5英里范围内找到其他点.但是,我似乎找不到STBuffer的单位",它似乎不符合英尺,英里,米,公里等.文档仅将它们称为单位",有任何建议?谢谢

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(xy)',4326).STBuffer(z).STIntersects(geography :: STGeomFromText('POINT('+ CAST(v.Longitude as varchar(max)))+''+ CAST(v.Latitude as varchar(max))+')',4326))= 1

[...] 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

推荐答案

STBuffer以米为单位.此处有更多信息.

STBuffer is in meters. More info here.

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

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

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

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

这篇关于SQL Server 2008地理.STBuffer()距离测量单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 11:29