STConvertToLineString: Extract LineStrings in GeometryCollection to create LineString

I had need today to create a function that extracts all linestring elements from a GeometryCollection and returns a LineString or a MultiLineString. The function is called STConvertToLineString as is described as follows: Its documentation can be seen see here. Here are some examples of how to use it: I hope this function is ofRead More

STGeometry2MBR/STGeography2MBR: Compute and return MBR ordinates

SQL Server Spatial’s STEnvelope() function returns the minimum bounding rectangle of a geometry object but as a 5 vertex polygon. To access the lower left and upper right XY ordinates requires use of the STPointN() and STX/STY methods against the relevant vertices of the polygon as follows: Which is long winded, indirect and error prone.Read 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

STCentroid*: Alternate Functions for Compute a Centroid

The top download from my website is for my package of centroid algorithms for Oracle sdo_geometry. There is nothing wrong with the STCentroid function implemented in SQL Server Spatial (for one thing it handles geography objects natively), but it seems that having a choice of centroid algorithms is a big thing for users of spatialRead More

STMorton: Creating a Morton Number Space Key Value for Grid Cells

Introduction NOTE: This article is a copy of the original first written in 2010 from my old website. Space curves are imaginary lines that systematically cover all tiles in an indexed space. The most well known in GIS is the Morton key. The utility of such a number can be seen though its implementing aRead More

COGO: Convert DMS String to decimal degrees floating point number.

In my article on DD2DMS I outlined how to convert a latitude or longitude as a decimal degrees value to a formatted string. This article describes a function, DMS2DD that reverses those values back to a single decimal degree value. Note that I have a schema call cogo in which I create functions like this.Read More

STDensify: Densify LineString or Polygon geometry objects

Requirement The ability to densify a lineString or polygon ring is a common requirement across database platforms. Some, like PostGIS, has such functionality “out of the box”. Others, such as Oracle Locator/Spatial do not which is why a function is available with the PL/SQL (Package and Object) code that is available for download from thisRead More