STFilterRings: Removing rings from Polygon based on area.

A function that have found use in Oracle and PostGIS is one that allows a user to filter out the rings of a polygon or multipolygon based on area. Here is presented a function to do this in SQL Server Spatial. This function requires Denali (2012) as it uses unionAggregate. In addition, the function requiresRead More

STMove: Function to Move a geometry object in SQL Server Spatial

If you have need for a TSQL based function for moving geometry objects in SQL Server Spatial (Denali is required), here is a function you might find useful. Now for some tests Point The result looks like this: Linestring The result looks like this: Move rectangle 10,10 The result looks like this: Curved polygon TheRead 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

STRotate: Function to rotate a geometry object in SQL Server Spatial

If you have need for a TSQL based function for rotating geometry objects in SQL Server Spatial (Denali is required), here is a function you might find useful. Now for some tests Rotate rectangle about itself and the origin The result looks like this (the background light blue rectangle is the original): Point The resultRead More

STVertices: Wrapper over STDumpPoints

Oracle’s point dumping function, mdsys.sdo_util.getVertices is most useful. When swapping between platforms sometimes I look first for such a function in SQL Server Spatial forgetting that I named it DumpPoints Here is a “wrapper” function for STDumpPoints. Testing it…. Result x y 148 -44 148 -43 147 -43 147 -44 148 -44 147.4 -43.6 147.2Read 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

Gridding a sdo_geometry line/polygon object (Oracle)

A common question that comes up in the various database forums (PostGIS, SQL Server, Oracle) is how to “grid” a linear or polygonal object. By “grid” one means work out the square pixels (rectangular polygons) that cover or define a vector geometry. Here is some SQL for doing this for Oracle Locator. Single Geometry HereRead More

Gridding a geometry object (PostGIS)

A common question that comes up in the various database forums (PostGIS, SQL Server, Oracle) is how to “grid” a linear or polygonal object. By “grid” one means work out the square pixels (rectangular polygons) that cover or define a vector geometry. Here is some SQL for doing this for PostGIS. Single Geometry The followingRead More

Gridding a geometry or geography object (SQL Server Denali)

A common question that comes up in the various database forums (PostGIS, SQL Server, Oracle) is how to “grid” a linear or polygonal object. By “grid” one means work out the square pixels (rectangular polygons) that cover or define a vector geometry. Here is some SQL for doing this for SQL Server 2008 Denali. DenaliRead More

Finding centre and radius of a circular geometry

Here is a method for finding the centre of a circle and its radius from a polygon (x003) sdo_geometry. Some examples: The SDO_UTIL.CIRCLE_POLYGON function is trickier because it generates 8307 longitude/latitude data. So the above function, based as it is on projected data, can only give us a basic approximation. The returned radius is goingRead More