Optimal location query based on k nearest neighbours