本文介绍了sql server中的3d空间对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用空间数据类型在 SQL Server 中定义 3D 实体?

Is there any way I can define a 3D solid within SQL Server using the spatial data type?

如果是这样,我可以看看如何做到这一点的例子吗?比如说,只是一个 1x1x1 的简单立方体?我是否必须定义 6 个多边形(立方体的每个面 1 个)并以某种方式一起使用它们?

If so, can I see an example of how this would be done? say, just a 1x1x1 simple cube?Would I have to define 6 polygons (1 for each face of the cube) and use those together somehow?

我在网上阅读的所有内容都倾向于展示纯 2D 形状的示例.我知道 Point 类型可以处理 X、Y、Z(和 M)——所以空间 3D 是可能的,但我发现很难找到好的例子.尤其是多边形/实体.

Everything I have read online tends to show examples purely with 2D shapes. I do know the Point type can handle X,Y,Z (and M) - So spatial 3D is possible, but I am finding it hard to get good examples. Especially of polygons / solids.

我想如果这是可能的,它会引出我的下一个问题:我很想使用一些可用的空间方法:STIntersection()、STContains() 等.针对这些 3D 对象.因为我们是在 3D 环境中,所以 STVolume() 函数会很棒!但我想这是我必须自己动手的事情.

I guess if this is possible, it leads onto my next question: I would love to use some of the spatial methods that are available: STIntersection(), STContains() etc. Against these 3D objects. And because we are in 3D, a STVolume() function would be fantastic! But that is something I would have to roll myself I guess.

也许有一个我需要的充满 SQL CLR 类型和空间扩展方法的库?

Perhaps there is a library full of SQL CLR Types and Spatial Extension methods that I am in need of?

谢谢.

推荐答案

已请求 3D 空间对象(在 Connect 上:提供对 3D 地理空间数据的支持) 早在 2008 年.

3D spatial objects have been requested (on Connect: Provide support for 3D Geo-Spatial Data) as far back as 2008.

正如您所提到的,可以使用 X、Y、Z 和 M 来表示具有高程的点,但是尚不直接支持操作 3D 对象.

As you mentioned, it is possible to utilise X,Y,Z and M to represent points with elevation, but there is no direct support for manipulating 3D objects yet.

以下示例使用 Z(高程)和M(测量)值并使用 Z 获取实例的 Z 值.

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POINT(1 2 3 4)', 0);
SELECT @g.Z;

参考.

SQL Server 2012 中的新空间功能

这篇关于sql server中的3d空间对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 02:19