SQL Server 2008 Geography .STBuffer() 距离测量单位
我正在使用纬度/经度处理一个地理点,并且需要在我们的数据库中查找该点 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
测量单位取决于所使用的空间参考系统。有关详细信息,请参阅此系统视图:
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;
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)
对于访问此页面的任何人来说,如果他们对为什么缓冲距离可能不以米为单位感到困惑,这可能是因为您使用的是几何数据类型而不是地理数据类型。就我而言,很明显,地理以米为单位,而几何则不然(看起来是度数?),即使为几何正确设置了空间参考系统。
要将纬度和经度转换为地理点:
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: