3d spatial objects in sql server

2019-07-05 06:00发布

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

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?

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.

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.

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

Thank you.

1条回答
姐就是有狂的资本
2楼-- · 2019-07-05 06:21

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

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.

The following example creates a Point instance with Z (elevation) and M (measure) values and uses Z to fetch the Z value of the instance.

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

Ref.

There was no mention of this or other 3D features in New Spatial Features in SQL Server 2012

查看更多
登录 后发表回答