Any record which inherits from this
TSQLRecordRTree class must
sftFloat (i.e. Delphi
fields, grouped by pairs, each as minimum- and maximum-value, up to 5
dimensions (i.e. 11 columns, including the ID property).
ID: integer property must be set before adding a
TSQLRecordRTree to the database, e.g. to link an R-Tree
representation to a regular
TSQLRecord table containing the main
Queries against the ID or the coordinate ranges are almost immediate: so you
can e.g. extract some coordinates box from the main regular
TSQLRecord table, then use a
query to make the process faster; this is exactly what the
TSQLRestClient. RTreeMatch method offers: for instance, running
aMapData. BlobField filled with
[-81,-79.6,35,36.2] the following lines:
will execute the following SQL statement:
SELECT MapData.ID From MapData, MapBox WHERE MapData.ID=MapBox.ID AND minX>=:(-81.0): AND maxX<=:(-79.6): AND minY>=:(35.0): AND :(maxY<=36.2): AND MapBox_in(MapData.BlobField,:('\uFFF0base64encoded-81,-79.6,35,36.2'):);
MapBox_in SQL function is registered in
TSQLRestServerDB. Create constructor for all
TSQLRecordRTree classes of the current database model. Both
ContainedIn class methods are used to
handle the box storage in the BLOB.
By default, it will process a raw
array of double, with a
default box match (that is
ContainedIn method will match the
minX>=...maxY<=... where clause).
Feedback and comments are welcome on our forum.