[postgis-users] Using PosGIS in one dimension
Alvaro Tejero Cantero
alvaro at minin.es
Fri Apr 27 01:40:56 PDT 2012
>> 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.
Just loading directly with arrays without intermediate list
construction would be the killer feature. Ironically, no matter how
fast the underlying RDBMS gets, the DBAPI interface is the bottleneck
in Python, and this is one of the major reasons why people go for
This message summarizes what is happening:
and this one gives some figures:
>> 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.
Well, I think what I meant is something else (much simpler): can I
store ranges and at the time of query cast them onto e.g. LINESTRINGS
so as to be able to use the power of MULTI* in PostGIS (but in the
future use constructs specific for ranges, when they get implemented)?
Then what I need is actually a bit different: not to combine (merge)
intervals in the same table, but to select only those intervals from
table A that are contained in (intervals of table B, C and D). As an
example imagine a database of playing chess, A is intervals of 'piece
is in the air' and I want to get all such intervals contained in B
'player is looking at opponent' and C 'player has his jacket on'
(assume he puts it on and off at random times during the game,
responding to air conditioning). I know I am bad at examples, but I
try my best not to invoke my (very specialized) example from
Do you advise to store linestrings instead of building them on the fly?
PS. by the way, I am sorry for the misspelling of PostGIS on the
Subject, it was a typo.
> postgis-users mailing list
> postgis-users at postgis.refractions.net
More information about the postgis-users