Hello again people
Not sure if this fits here (or at the Hatbox level), but I was
wondering how to ask GeoDB to efficiently compute the bounds of a
given set of objects. Something like this:
SELECT GetBounds(myGeomAttribute) FROM myTable WHERE [..condition..]
This is possible with Postgis, Oracle Spatial, SQLServer 2008, etc,
but I couldn't find out a way to do this efficiently using GeoDB/
Hatbox.
I did some looking around, and saw that:
- GeoTools' H2 DataStore implementation seems to compute the envelope
of each entry and merge them one by one. This sounds really slow,
since taking a look at ST_Envelope seems to imply that every entry's
geometry read into memory and decoded in order to compute each
envelope. Is that right?
- Looking at Hatbox's internal structure, it seems that every entry's
envelope is already computed and stored in its RTree Node structures.
So, I was thinking if one could implement an AggregateFunction (http://
www.h2database.com/html/grammar.html#create_aggregate) to put together
all of the entries envelopes. Unfortunately, I guess some
implementation changes would be needed in Hatbox in order to be able
to efficiently retrieve an Entry given its ID.
Well, I really hope there's an easier solution.. It does sound really
weird to me that a spatial extension cannot easily compute bounds! :P
Thanks,
Milton
PS: as a side note, the latest Hatbox version (1.0.b9) includes a new
method Proc.getDatasetBounds that unfortunately only dumbly computes
bounds for the entire dataset (uses the RTree's root Node's bounds
directly).