Generic kdtree to support spatio-temporal query