{"action":"created","issue":{"url":"https://api.github.com/repos/pysal/pysal/issues/679","labels_url":"https://api.github.com/repos/pysal/pysal/issues/679/labels{/name}","comments_url":"https://api.github.com/repos/pysal/pysal/issues/679/comments","events_url":"https://api.github.com/repos/pysal/pysal/issues/679/events","html_url":"https://github.com/pysal/pysal/issues/679","id":97837188,"number":679,"title":"pysal.cg.sphere.fast_knn bug","user":{"login":"nutka7","id":9833398,"avatar_url":"https://avatars.githubusercontent.com/u/9833398?v=3","gravatar_id":"","url":"https://api.github.com/users/nutka7","html_url":"https://github.com/nutka7","followers_url":"https://api.github.com/users/nutka7/followers","following_url":"https://api.github.com/users/nutka7/following{/other_user}","gists_url":"https://api.github.com/users/nutka7/gists{/gist_id}","starred_url":"https://api.github.com/users/nutka7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nutka7/subscriptions","organizations_url":"https://api.github.com/users/nutka7/orgs","repos_url":"https://api.github.com/users/nutka7/repos","events_url":"https://api.github.com/users/nutka7/events{/privacy}","received_events_url":"https://api.github.com/users/nutka7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pysal/pysal/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-29T01:41:39Z","updated_at":"2015-07-29T22:17:32Z","closed_at":"2015-07-29T22:17:32Z","body":"Hello, I wanted to use this function, but I read the source code and I believe I found a bug:\r\n\r\n    pts = numpy.array(pts)\r\n    kd = scipy.spatial.KDTree(pts)\r\n    d, w = kd.query(pts, k + 1)\r\n\r\nI can't understand how this is supposed to work while scipy.spatial.KDTree supports cartesian coordinates and NOT circular. Mapping from a sphere to a plane can make two close points very distant leading to wrong answer.\r\n\r\nMoreover calculating distance directly from (lon, lat) coordinates using euclidean metric can lead to wrong results (it can mess the order of closest points."},"comment":{"url":"https://api.github.com/repos/pysal/pysal/issues/comments/126112594","html_url":"https://github.com/pysal/pysal/issues/679#issuecomment-126112594","issue_url":"https://api.github.com/repos/pysal/pysal/issues/679","id":126112594,"user":{"login":"sjsrey","id":118042,"avatar_url":"https://avatars.githubusercontent.com/u/118042?v=3","gravatar_id":"","url":"https://api.github.com/users/sjsrey","html_url":"https://github.com/sjsrey","followers_url":"https://api.github.com/users/sjsrey/followers","following_url":"https://api.github.com/users/sjsrey/following{/other_user}","gists_url":"https://api.github.com/users/sjsrey/gists{/gist_id}","starred_url":"https://api.github.com/users/sjsrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjsrey/subscriptions","organizations_url":"https://api.github.com/users/sjsrey/orgs","repos_url":"https://api.github.com/users/sjsrey/repos","events_url":"https://api.github.com/users/sjsrey/events{/privacy}","received_events_url":"https://api.github.com/users/sjsrey/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T22:17:32Z","updated_at":"2015-07-29T22:17:32Z","body":"Yes, that is true. To do the knn search using arc distances in PySAL see [Arc_KDTree](https://github.com/pysal/pysal/blob/master/pysal/cg/kdtree.py#L18)."}}