Line Merging or Collecting lines together: ST_LineMerger

One activity that is very common when working with linear data is to be able to take a bunch of linestrings and collect them together into a minimal set of maximum length linestrings. The Java Topology Suite (JTS) has a LineMerger class that does this very nicely. I have integrated this into my Spatial CompanionRead More

3D/4D and SRID aware Conversion functions for SDO_Geometry: WKT and EWKT

Oracle Spatial does not read or write 3D Well-known text (WKT); nor does it read/write measures. Oracle’s SDO_Geometry implementation only supports the OGC Simple Features 1.1 specification which is 2D only. What I have done is expose the Jaspa/JTS implementation of methods more 3D+ aware to PL/SQL and therefore SQL via my Spatial Companion forRead More

Topological vs Non-Topological Simplification/Generalization of Aggregated Area Geometies in Oracle

Oracle has a function, sdo_util.simplify that can simplify (generalize) the vertices describing a geometric object (that is, reduce the number in a way that maintains basic shape). However, that function only operates on a single geometry at a time. Using it on polygonal data that completely covers an area (planar enforced) can and will causeRead More

STExtractPolygon: Extract Polygons from result of STIntersection in SQL Server Spatial

Oracle customers have asked me for help in the past dealing with compound objects or collections that result from thinning or geoprocessing (intersection etc) of geometry data. Normally this is the need to extract only polygons from the result of an intersection operation. This problem applies to SQL Server Spatial users are the following exampleRead More

STRound: Function to round ordinates of a SQL Server Spatial geometry object

The result of many geoprocessing operations in any spatial type can be geometries with ordinates (X, Y etc) that have far more decimal digits of precision than the initial geometry. I present here a simple function STRound that takes a geometry object and some specifications of the precision of any X, Y, Z or MRead More

STExtract: Extract elements of a geometry object

Of the functions I have written for Oracle, those that allow me to extract (sub)elements of compound (objects consisting of linestrings and circular arcs) and multipart geometries have found use time and time again in such activities as: Filtering Rings of Polygons; Extracting homogeneous objects (eg point, line or polygon) from geometry collections. This articleRead More

STNumRings: Counting number of polygon rings

Here is an “ease of use” function that allows you to count the number of rings of a polygon or multipolygon geometry object in SQL Server Spatial. Some tests. Resulting in: gtype numRings Point 0 MultiPoint 0 LineString 0 MultiLineString 0 Polygon Outer 1 Polygon 3 MultiPolygon 5 CurvePolygon 1 GeometryCollection 1 I hope thisRead More