{"action":"created","issue":{"url":"https://api.github.com/repos/graphhopper/graphhopper/issues/1139","repository_url":"https://api.github.com/repos/graphhopper/graphhopper","labels_url":"https://api.github.com/repos/graphhopper/graphhopper/issues/1139/labels{/name}","comments_url":"https://api.github.com/repos/graphhopper/graphhopper/issues/1139/comments","events_url":"https://api.github.com/repos/graphhopper/graphhopper/issues/1139/events","html_url":"https://github.com/graphhopper/graphhopper/issues/1139","id":251125248,"number":1139,"title":"Requests with #Points > 2, duplicated points at waypoints","user":{"login":"boldtrn","id":1553525,"avatar_url":"https://avatars3.githubusercontent.com/u/1553525?v=4","gravatar_id":"","url":"https://api.github.com/users/boldtrn","html_url":"https://github.com/boldtrn","followers_url":"https://api.github.com/users/boldtrn/followers","following_url":"https://api.github.com/users/boldtrn/following{/other_user}","gists_url":"https://api.github.com/users/boldtrn/gists{/gist_id}","starred_url":"https://api.github.com/users/boldtrn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boldtrn/subscriptions","organizations_url":"https://api.github.com/users/boldtrn/orgs","repos_url":"https://api.github.com/users/boldtrn/repos","events_url":"https://api.github.com/users/boldtrn/events{/privacy}","received_events_url":"https://api.github.com/users/boldtrn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-18T02:48:18Z","updated_at":"2017-08-22T02:18:27Z","closed_at":null,"body":"I just understood the issue with the extra point for requests which have via points, that we discussed [here](https://github.com/graphhopper/graphhopper/pull/1091#issuecomment-321506225).\r\n\r\nWhen there is a GHRequest with for example 3 Points. We merge two Paths. Usually, the last point of the first Path is equal to the first point of the second Path. Right now we just append the two Paths. This leads to a duplication of points. For example have a look at this [route](https://graphhopper.com/maps/?point=49.984352%2C11.498802&point=49.984565%2C11.499188&point=49.9847%2C11.499612&points_encoded=false).\r\n\r\nThe resulting points json looks like this:\r\n```\r\npoints: {\r\ncoordinates: [\r\n[\r\n11.498807,\r\n49.984347\r\n],\r\n[\r\n11.499067,\r\n49.98446\r\n],\r\n[\r\n11.499214,\r\n49.984541\r\n],\r\n=============================\r\nHere is the waypoint, you see that the point above and below are duplicated\r\n=============================\r\n[\r\n11.499214,\r\n49.984541\r\n],\r\n[\r\n11.499627,\r\n49.984682\r\n]\r\n],\r\ntype: \"LineString\"\r\n},\r\n```\r\nOverall, this is not very critical. The better or cleaner solution would probably be to not duplicate these points, but we would have to change our instructions then.\r\n\r\nRight now the ViaPointInstruction, references the first duplicated point. The ContinueInstruction references the second duplicated point. If we remove one of these points, we could not continue with this pattern.\r\n\r\n```\r\n{\r\ndistance: 0,\r\nsign: 5,\r\ninterval: [\r\n2,\r\n3\r\n],\r\ntext: \"Waypoint 1\",\r\ntime: 0,\r\nstreet_name: \"\"\r\n},\r\n{\r\ndistance: 33.387,\r\nsign: 0,\r\ninterval: [\r\n3,\r\n4\r\n],\r\ntext: \"Continue onto Waldhüttenstraße\",\r\ntime: 7512,\r\nstreet_name: \"Waldhüttenstraße\"\r\n},\r\n``` "},"comment":{"url":"https://api.github.com/repos/graphhopper/graphhopper/issues/comments/323900482","html_url":"https://github.com/graphhopper/graphhopper/issues/1139#issuecomment-323900482","issue_url":"https://api.github.com/repos/graphhopper/graphhopper/issues/1139","id":323900482,"user":{"login":"boldtrn","id":1553525,"avatar_url":"https://avatars3.githubusercontent.com/u/1553525?v=4","gravatar_id":"","url":"https://api.github.com/users/boldtrn","html_url":"https://github.com/boldtrn","followers_url":"https://api.github.com/users/boldtrn/followers","following_url":"https://api.github.com/users/boldtrn/following{/other_user}","gists_url":"https://api.github.com/users/boldtrn/gists{/gist_id}","starred_url":"https://api.github.com/users/boldtrn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boldtrn/subscriptions","organizations_url":"https://api.github.com/users/boldtrn/orgs","repos_url":"https://api.github.com/users/boldtrn/repos","events_url":"https://api.github.com/users/boldtrn/events{/privacy}","received_events_url":"https://api.github.com/users/boldtrn/received_events","type":"User","site_admin":false},"created_at":"2017-08-22T02:18:27Z","updated_at":"2017-08-22T02:18:27Z","body":"> Can we avoid adding points from a ViaInstruction to the \"fullPoins\" in PathMerger?\r\n> Or should we make the correct but Java-API-breaking refactoring?\r\n\r\nI think that, your described change would not fix the issue. The issue is that the ViaInstruction and the next instruction after the ViaInstruction reference the same coordinate.\r\n\r\nCurrently, every point in the points array, belongs to exactly one Instruction. So the \"correct\" change would be to break this assumption. To use the example given above, we would remove the duplicated point\r\n\r\n```\r\n[\r\n11.499214,\r\n49.984541\r\n]\r\n```\r\n\r\nThen we would have to change the references of the Instructions to:\r\n\r\n```\r\n{\r\ndistance: 0,\r\nsign: 5,\r\ninterval: [\r\n2,\r\n3\r\n],\r\ntext: \"Waypoint 1\",\r\ntime: 0,\r\nstreet_name: \"\"\r\n},\r\n{\r\ndistance: 33.387,\r\nsign: 0,\r\ninterval: [\r\n2,\r\n3\r\n],\r\ntext: \"Continue onto Waldhüttenstraße\",\r\ntime: 7512,\r\nstreet_name: \"Waldhüttenstraße\"\r\n},\r\n```\r\n\r\n> Currently the normal instructions have the interval [from, last-1] and the ViaInstructions and FinishInstructions have [from,last]\r\n\r\nAre you sure? To me it looks like the other way around.\r\n\r\nIn [InstructionList#createJson](https://github.com/graphhopper/graphhopper/blob/91ca93d8520480f3d103a79962ecabad35f72c78/core/src/main/java/com/graphhopper/util/InstructionList.java#L107) we do:\r\n\r\n```\r\n// the last instruction should not point to the next instruction\r\nif (counter + 1 == instructions.size())\r\n   tmpIndex--;\r\n```"}}
{"actor":{"display_login":"boldtrn"}}