[postgis-users] Using PosGIS in one dimension

Mike Toews mwtoews at gmail.com
Thu Apr 26 13:02:39 PDT 2012


On 27 April 2012 00:05, Alvaro Tejero Cantero <alvaro at minin.es> wrote:
> 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)

Great it's helpful! It probably deserves a better publishing platform
than SO though.

> 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/ ).

I've never heard of the package until now, but I'll check it out.
There appears to be a sizable niche of presumably scientists that
require linkage beteen numpy and postgres.

(snip)
>
> 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)?

I think you mean using an aggregate to combine many intervals from
several rows into one. I don't see any aggregate functions for the
range type, and as I mentioned, it wouldn't know how to express the
union of two ranges that don't touch (i.e., a discontinuous range,
which would require some MULTI* structure). PostGIS has several
aggregates, like ST_Union and ST_MemUnion, all are pretty reliable and
fast. Not sure about the exclude constraint, but I think it is based
on the GiST index.

-Mike



More information about the postgis-users mailing list