Querying on 2d datasets