{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/stplanr/issues/91","repository_url":"https://api.github.com/repos/ropensci/stplanr","labels_url":"https://api.github.com/repos/ropensci/stplanr/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/stplanr/issues/91/comments","events_url":"https://api.github.com/repos/ropensci/stplanr/issues/91/events","html_url":"https://github.com/ropensci/stplanr/issues/91","id":169592074,"number":91,"title":"line2route with unroutable lines","user":{"login":"nikolai-b","id":6289830,"avatar_url":"https://avatars.githubusercontent.com/u/6289830?v=3","gravatar_id":"","url":"https://api.github.com/users/nikolai-b","html_url":"https://github.com/nikolai-b","followers_url":"https://api.github.com/users/nikolai-b/followers","following_url":"https://api.github.com/users/nikolai-b/following{/other_user}","gists_url":"https://api.github.com/users/nikolai-b/gists{/gist_id}","starred_url":"https://api.github.com/users/nikolai-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikolai-b/subscriptions","organizations_url":"https://api.github.com/users/nikolai-b/orgs","repos_url":"https://api.github.com/users/nikolai-b/repos","events_url":"https://api.github.com/users/nikolai-b/events{/privacy}","received_events_url":"https://api.github.com/users/nikolai-b/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-05T12:01:03Z","updated_at":"2016-08-05T12:40:31Z","closed_at":null,"body":"If the the start or end point of the line is far away from the route network (e.g. in a lake) then cyclestreets fails to create a route the line.  I believe this currently fails silently.\r\n\r\nI am suggesting an improvement but would like feedback here first:\r\n\r\nMake an API call api.cyclestrees.new/route?start=xxx&end=yyy\r\nListen to response\r\na) The response is a route - continue as before\r\nb) If response is a straight line (or an error) suggesting that cyclestreets cannot route the line then....\r\n  make 2 calls to graphopper (or another API) to:\r\n  b1) snap xxx to the nearest point in the route network xxx2\r\n  b2) snap yyy to the nearest point in the route network yyy2\r\n  Make another API call api.cyclestrees.new/route?start=xxx2&end=yyy2"},"comment":{"url":"https://api.github.com/repos/ropensci/stplanr/issues/comments/237839992","html_url":"https://github.com/ropensci/stplanr/issues/91#issuecomment-237839992","issue_url":"https://api.github.com/repos/ropensci/stplanr/issues/91","id":237839992,"user":{"login":"richardellison","id":10625733,"avatar_url":"https://avatars.githubusercontent.com/u/10625733?v=3","gravatar_id":"","url":"https://api.github.com/users/richardellison","html_url":"https://github.com/richardellison","followers_url":"https://api.github.com/users/richardellison/followers","following_url":"https://api.github.com/users/richardellison/following{/other_user}","gists_url":"https://api.github.com/users/richardellison/gists{/gist_id}","starred_url":"https://api.github.com/users/richardellison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardellison/subscriptions","organizations_url":"https://api.github.com/users/richardellison/orgs","repos_url":"https://api.github.com/users/richardellison/repos","events_url":"https://api.github.com/users/richardellison/events{/privacy}","received_events_url":"https://api.github.com/users/richardellison/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T12:40:31Z","updated_at":"2016-08-05T12:40:31Z","body":"I would suggest a wrapper script around line2route that runs the process you suggest. You would then get a function that does:\r\n\r\n1. Call line2route normally\r\n2. Select a subset of the SpatialLinesDataFrame that contains only the routes that failed in the initial call.\r\n3. Snap each of the coordinates to the nearest point on the route network using another algorithm\r\n4. Run line2route with the subset with updated coordinates\r\n5. Replace the failed routes with the new ones."}}
{"actor":{"display_login":"richardellison"}}