spatial queries and progress bar working