Added sort mode to geo distance sorting. Closes #1846