Implemented spatial ranking function (#141)