[postgis-users] Using PosGIS in one dimension

Alvaro Tejero Cantero alvaro at minin.es
Thu Apr 26 05:05:30 PDT 2012


Hi Mike!

Thank you. Your tip about loading numpy data into PostgreSQL will be key
for my application (
http://stackoverflow.com/questions/8144002/use-binary-copy-table-from-with-psycopg2
)

In fact, do you know about the reverse process (loading to numpy arrays)?
It seems that Psycopg2 cannot do it but there is a project tackling that
problem --- I don't know if this could eventually be incorporated into the
mainstream driver (http://code.google.com/p/pgnumpy/ ).

(snip)

The range type has a whole host of set-style functions and operators,
> like union, difference, intersection, etc.:
> http://www.postgresql.org/docs/devel/static/functions-range.html
>
> 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)'));
>               st_astext
> ---------------------------------------
>  MULTILINESTRING((4 0,6 0),(7 0,10 0))
> (1 row)


That is what I was hoping for (only with less overhead from the 2nd, unused
coordinate). Is it is possible to build the LINESTRING from the interval
type on the fly for these operations (so as to keep the in-disk
representation compact and also supportive of the exclude constraint)?

Thanks,

Álvaro.


> -Mike
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120426/5e81e1b5/attachment.html>


More information about the postgis-users mailing list