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

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

LINEAR (LRS)

UPDATED: This package of functions underwent a revamp in early July 2012. In that revamp: ST_Locate_Point was overhauled to correctly handle both distance based segmentation of 2D lines as well as Measured geometries (p_value_Type parameter now fully handled). ST prefixes added to public functions._ T_Vector Type enhanced ST_GetVector renamed to ST_Vectorize Bugs fixed in ST_SplitRead 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

COGO: Compute number of vertices required to stroke circle or circular arc

In working with circles or arc segments one needs to be able to do more than just calculate chordlengths, arclengths or arc2chord separations. For example, in order to be able to convert circles and arcs to vertex-stroked polygons and vice versa one needs to be able to compute the number of vertices to place betweenRead More