PostGIS 整合 SFCGAL，优雅的处理3D空间数据。
So, for those of you who haven’t seen it, SFCGAL , “a C++ wrapper library around CGAL with the aim of supporting ISO 19107:2013 and OGC Simple Features Access 1.2 for 3D operations” is now an optional include in PostGIS (I believe beginning with 2.1, forgive me if I’m wrong).
This was a quiet outcome of the Boston Code Sprint, after Paul Ramsey declared exact rational number representation would not make its way into PostGIS.
(I promise, that’s the only animated gif I’ll ever do, hat tip James Fee who did it for years before it was cool).
What does this mean for a typical PostGIS user? Well, so far it adds a nice suite of new 2D and 3D functions :
postgis_sfcgal_version — Returns the version of SFCGAL in use ST_Extrude — Extrude a surface to a related volume ST_StraightSkeleton — Compute a straight skeleton from a geometry ST_ApproximateMedialAxis — Compute the approximate medial axis of an areal geometry. ST_IsPlanar — Check if a surface is or not planar ST_Orientation — Determine surface orientation ST_ForceLHR — Force LHR orientation ST_MinkowskiSum — Performs Minkowski sum ST_3DIntersection — Perform 3D intersection ST_3DDifference — Perform 3D difference ST_3DUnion — Perform 3D union ST_3DArea — Computes area of 3D surface geometries. Will return 0 for solids. ST_Tesselate — Perform surface Tesselation of a polygon or polyhedralsurface and returns as a TIN or collection of TINS ST_Volume — Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0. ST_MakeSolid — Cast the geometry into a solid. No check is performed. To obtain a valid solid, the input geometry must be a closed Polyhedral Surface or a closed TIN. ST_IsSolid — Test if the geometry is a solid. No validity check is performed.
ST_Extrude is fun，this is a function for doing things like this:
Simulated extruded building footprints.
Extruded footprints from (ahem) City Engine. Ssssh. Don’t tell.
ST_StraightSkeleton does in one step the first phase of what I’ve been going on about for a couple years re: Voronoi diagrams (and bypasses Voronoi altogether):
Approximation of straight skeleton / skeletonization of stream polygon。
Plus more! I’ve just started exploring.
BTW, in advance of there being an SFCGAL install guide for PostGIS, a good source for info on install can be gleaned from the PostGIS Developers listserve .