STCogo2Line: Creating (Multi)LineStrings geometries from COGO XML instructions

Previously I wrote about a function that converted the segments of a (Multi)LineString into a COGO XML document that contains all the instructions (bearing, distances, move deltaZ etc) to create a (Multi)LineString. Today I present a function that does the reverse: takes the COGO XML and creates the (Multi)LineString. The instructions are provided to theRead More

STLine2Cogo: Converting LineStrings to COGO XML

I have just written a useful function for my new package of TSQL functions for SQL Server Spatial called STLine2Cogo which converts (exports) a (Multi)LineString into a set of instructions (bearing, distances etc) that can be shared with other COGO functions. The function’s documentation can be seen at this STLine2Cogo Here are some examples: TheRead More

STVectorize: Break Linestring/Polygon elements into 2 point vectors (or 3 point circular curves)

I demonstrated in this article the usefulness of having a vectorising function in one’s spatial database kitbag (there are Vectorize functions in my CENTROID and GEOM packages – in particular the Vectorize function is vital to the implementation of the algorithm in my CENTROID.ST_CENTROID function). So, I have also added one to my SQL ServerRead More

Noding and building a polygon from single, overlapping linestrings

The Spatial Companion 4 Oracle (SC4O) package (built using Java Topology Suite components) contains a method called ST_PolygonBuilder that can then form polygons from linestrings. However, ST_PolygonBuilder will not form polygons where it detects an unformed intersection: in this situation ST_PolygonBuilder has to be used with another SC4O method called ST_NodeLinestrings. ST_NodeLinestrings forms all intersectionsRead More

Sorting SDO_GEOMETRY data using the ORDER BY clause of a SELECT statement

It is often observed that you cannot use an sdo_geometry object in an ORDER BY clause of a SELECT statement. This is demonstrated below. Test Data Now, if we try and sort this data we get: If you look at the SDO_GEOMETRY type you will see that it does not have a MAP or ORDERRead More

STScale: Function to Scale a geometry object

Here is a simple scaling function for use with SQL Server Spatial’s geometry data type. Now some tests. Results sType geomWKT Scaled2D LINESTRING (0.5 1.5 3, 0.5 0.75 1) Original LINESTRING (1 2 3, 1 1 1) Results sType geomWKT Scaled3D LINESTRING (0.5 1.5 2.4, 0.5 0.75 0.8) Original LINESTRING (1 2 3, 1 1Read 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