[postgis-users] Using PosGIS in one dimension

Mike Toews mwtoews at gmail.com
Wed Apr 25 15:26:27 PDT 2012

On 26 April 2012 09:54, Alvaro Tejero Cantero <alvaro at minin.es> wrote:
> David, Mike,
> thank you very much for this spot-on information!
> I have two follow-up questions:
> 1/ is there an estimated release date for pg 9.2? (in its stead: are
> Postgres pre-release versions usually 'stable enough' - I am in an
> explorative setting, rock-solid stability is not yet needed).

Here is the roadmap: http://www.postgresql.org/developer/roadmap/

It looks like beta releases start soon, followed by final in Q3 of
2012. As the range type is new, I'm sure the postgres developers would
love to have some beta testers. I had a play with the range type
several months ago, and I found it functional.

> 2/ do these functions work with sets of intervals? I found an older post
> about an extension that seems to care for that
> http://scottrbailey.wordpress.com/2009/10/06/timespan_sets/
> and I am concerned about how to do that efficiently (i.e. without a double
> loop on A intervals and B intervals).

The range type has a whole host of set-style functions and operators,
like union, difference, intersection, etc.:

One limitation of the range type that I came across is that there is
no MULTI* equivalent. So you can have a continuous range of [4,10),
but you can't punch a "hole" (6,7] within it (i.e., difference). To
me, this "difference yielding multi" issue is conceptualized as:
    [4,10) - (6,7] = [4,6] _gap_ (7,10)

.. can't work (throws an error), since there is no way to express a
single range with a discontinuity. But with that thought, you could
turn PostGIS into a similar 1D tool, using the MULTILINESTRING, using
the x coordinate as your dimension, and ignoring all y coordinates.
The above problem is:

SELECT ST_AsText(ST_Difference(
                        'LINESTRING(4 0, 10 0)',
                        'LINESTRING(6 0,  7 0)'));
 MULTILINESTRING((4 0,6 0),(7 0,10 0))
(1 row)


More information about the postgis-users mailing list