A funny distance measure . . . and the power of spatial SQL

  • Posted on: 1 February 2012
  • By: deby
Average distance definition

We all know that distance computations are a common thing in many GIS projects, and that all serious spatial data systems allow you to perform such computations through a built-in function, often simply called distance. And everyone of us knows the square root definition for the case of point-to-point distances.

This notion of distance is based on minimal values, and equally easily one can define a notion of distance based on maximal values. Now, in the context of the work with Gaurav Singh, in an attempt to normalize distances occurring in different provinces, we needed to know what is the average distance of points in a polygon P to the centroid point c ('centre of mass') of P. By this, I really meant to find a computational realization ('implementation of an algorithm') of the formula as in the attached illustration above.

I have implemented such a function in PG SQL, and the full write-up is here: link into doodooland. The write-up defines the function and provides the full code to compute it from a PG database.

-- rdb

Working with curves in PostGIS

  • Posted on: 29 January 2012
  • By: morales

PostGIS included curved geometry data types in version 1.4, but the functions to operate on curves was limited, and required the curve object to be converted into a linearized approximation, using a function such as ST_CurveToLine. In PostGIS 2.0 this will change as the approach is to look at the circle the arc is inscribed on.


In 2.0 arcs are defined using a start point, mid point and end point implying a circle. By calculating the center of the circle it is possible it is possible to determine that a successive point, which occurs the same distance from that center point as the arc points, forms part of the arc.
Read more at Getting Curvey.

Pages