空间查询,将米转换为弧度?
我有已加载到地理数据类型中的地理数据。出于非常具体的目的,我现在需要将其存储为几何图形。但是,我需要执行这样的查询。
DECLARE @radius INT -- e.g. 3000 metres
DECLARE @geo geometry -- my starting shape
SET @geo = @geo.STBuffer(@radius) -- this obviously doesnt work..
SELECT Geo FROM GeometryTable
WHERE Geo.STWithin (@geo) = 1
I have geographic data that was loaded into the geography datatype. For very specific purposes, I now need to have store this as a geometry. However, I need to perform a query like this.
DECLARE @radius INT -- e.g. 3000 metres
DECLARE @geo geometry -- my starting shape
SET @geo = @geo.STBuffer(@radius) -- this obviously doesnt work..
SELECT Geo FROM GeometryTable
WHERE Geo.STWithin (@geo) = 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
米是长度的单位,而弧度是角度的单位,所以我认为你不能。
您想计算弧长吗?
请查看以下链接:
Meters are a measure of length while radians are a measure of an angle so i don't think you can.
Are you trying to calculate an arc length?
Take a look at the links below:
如果有人可以验证该技术或提供更好的替代方案,那么这个技巧可能会起作用,那么他们就会得到可接受的答案。
基本上,我想我可以使用地理的 STBuffer,它将在我的地理形状周围应用正确的半径(以米为单位),然后转换回几何形状。由于形状最初是作为地理加载的,因此所有点都是相同的。这种形状翻转应该会给我一个结果几何图形,周围有一个非常准确的缓冲区。
This trick might work, if someone can validate this technique or provide a better alternative then they'll get the accepted answer.
Basically, I am thinking I can use the STBuffer of a geography which will apply the correct radius in metres around my geographical shape and then I convert back to a geometry. As the shapes were loaded originally as geography all the points are the same. This shape-flip should give me a resulting geometry with a pretty accurate buffer around it.