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 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

RandomSearchByExtent: Random Search Procedure (2008 Spatial)

I have had the need, over the years, to produce statistics that helped me decide how effective a change to a property of a spatial table or index might be. For example, with SQL Server 2008’s Spatial Index, for most sites, setting the right properties to get the best performance is a trial and errorRead More

COGO: Converting (Google Earth) Formatted Longitude/Latitude points to decimal degrees (SQL Server)

In an article on Oracle I described how to convert Google Earth textual representations of a longitude or latitude value to its decimal equivalent. Here is a version that will work with SQL Server 2008/2012 Spatial. And here are a few examples. Result DD -43.0138888888889 43.5126388888889 147.841833333333 -65.1701666666667 I hope this is of use toRead More

COGO: Convert Degrees, Minutes and Seconds values to Decimal Degrees

Sometimes data is provided to spatial databases via spreadsheets or other database tables in the form of degrees, minutes and seconds values. For example, data may come like this: Degree Minute Seconds 45 30 30.0 Which then need converting to a single decimal degree floating point value for use as an ordinate in a spatialRead 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

COGO: DD2DMS Formatting a latitude/longitude decimal degree value

Many years ago I had need to annotate the lines of a cadastral (land titles) polygon with the bearing and distance of each line. The bearings and distances need to be computed from the boundary of each land parcel. The annotation had to be formatted as DD^MM’SS.SS”. This was achieved with a function called DD2DMSRead More