{"action":"created","comment":{"url":"https://api.github.com/repos/valhalla/thor/pulls/comments/91610739","pull_request_review_id":12121697,"id":91610739,"diff_hunk":"@@ -27,39 +26,108 @@ namespace {\n   const headers_t::value_type JSON_MIME { \"Content-type\", \"application/json;charset=utf-8\" };\n   const headers_t::value_type JS_MIME { \"Content-type\", \"application/javascript;charset=utf-8\" };\n \n-  json::MapPtr serialize(odin::TripPath trip_path, const boost::optional<std::string>& id, double scale) {\n+\n+  json::MapPtr serialize(TripPathController& controller, valhalla::odin::TripPath trip_path, const boost::optional<std::string>& id, double scale) {\n+    //lets get some edge attributes\n     json::ArrayPtr edges = json::array({});\n     for (int i = 1; i < trip_path.node().size(); i++) {\n+\n       if (trip_path.node(i-1).has_edge()) {\n         const auto& edge = trip_path.node(i - 1).edge();\n         auto names = json::array({});\n-        for (const auto& name : edge.name())\n-          names->push_back(name);\n-\n-        edges->emplace_back(json::map({\n-          {\"max_downward_grade\", static_cast<int64_t>(edge.max_downward_grade())},\n-          {\"max_upward_grade\", static_cast<int64_t>(edge.max_upward_grade())},\n-          {\"weighted_grade\", json::fp_t{edge.weighted_grade(), 3}},\n-          {\"length\", json::fp_t{edge.length() * scale, 3}},\n-          {\"speed\", json::fp_t{edge.speed() * scale, 3}},\n-          {\"way_id\", static_cast<uint64_t>(edge.way_id())},\n-          {\"id\", static_cast<uint64_t>(edge.id())},\n-          {\"names\", names}\n-        }));\n+\n+        auto edgemap = json::map({});\n+        if (edge.has_max_downward_grade())\n+          edgemap->emplace(\"max_downward_grade\", static_cast<int64_t>(edge.max_downward_grade()));\n+        if (edge.has_max_upward_grade())\n+          edgemap->emplace(\"max_upward_grade\", static_cast<int64_t>(edge.max_upward_grade()));\n+        if (edge.has_weighted_grade())\n+          edgemap->emplace(\"weighted_grade\", json::fp_t{edge.weighted_grade(), 3});\n+        if (edge.has_length())\n+          edgemap->emplace(\"length\", json::fp_t{edge.length() * scale, 3});\n+        if (edge.has_speed())\n+          edgemap->emplace(\"speed\", json::fp_t{edge.speed() * scale, 3});\n+        if (edge.has_way_id())\n+          edgemap->emplace(\"way_id\", static_cast<uint64_t>(edge.way_id()));\n+        if (edge.has_id())\n+          edgemap->emplace(\"id\", static_cast<uint64_t>(edge.id()));\n+        if (edge.has_end_shape_index())\n+          edgemap->emplace(\"end_shape_index\", static_cast<int64_t>(edge.end_shape_index()));\n+        if (edge.has_begin_shape_index())\n+          edgemap->emplace(\"begin_shape_index\", static_cast<int64_t>(edge.begin_shape_index()));\n+        if (edge.name_size() > 0) {\n+          for (const auto& name : edge.name())\n+            names->push_back(name);\n+          edgemap->emplace(\"names\", names);\n+        }\n+        if (controller.node_attribute_enabled()) {\n+          auto node = trip_path.node(i);\n+          auto end_node = json::array({});\n+          auto intersecting_edges = json::array({});\n+          if (node.intersecting_edge_size() > 0) {\n+            for (const auto& intersecting_edge : node.intersecting_edge())\n+              intersecting_edges->push_back(static_cast<uint64_t>(intersecting_edge.begin_heading()));\n+          }\n+          end_node->emplace_back(json::map({\n+            {\"intersecting_edges\", intersecting_edges}\n+          }));\n+          edgemap->emplace(\"end_node\", end_node);\n+        }\n+\n+        edges->emplace_back(edgemap);\n+\n+        auto json = json::map({\n+          {\"edges\", edges}\n+        });\n+        if (id)\n+          json->emplace(\"id\", *id);\n+        if (edge.has_begin_shape_index() || edge.has_end_shape_index())\n+          json->emplace(\"shape\", trip_path.shape());\n+\n+        return json;\n       }\n     }\n-    auto json = json::map({\n-      {\"edges\", edges}\n-    });\n-    if (id)\n-      json->emplace(\"id\", *id);\n-    return json;\n   }\n }\n \n namespace valhalla {\n namespace thor {\n \n+void thor_worker_t::filter_attributes(const boost::property_tree::ptree& request, TripPathController& controller) {\n+  std::unordered_set<std::string> attributes_include_;","path":"src/thor/trace_attributes_action.cc","position":109,"original_position":109,"commit_id":"b010f1048873b1e1538385f69924dafee227bad6","original_commit_id":"b010f1048873b1e1538385f69924dafee227bad6","user":{"login":"dgearhart","id":7515853,"avatar_url":"https://avatars.githubusercontent.com/u/7515853?v=3","gravatar_id":"","url":"https://api.github.com/users/dgearhart","html_url":"https://github.com/dgearhart","followers_url":"https://api.github.com/users/dgearhart/followers","following_url":"https://api.github.com/users/dgearhart/following{/other_user}","gists_url":"https://api.github.com/users/dgearhart/gists{/gist_id}","starred_url":"https://api.github.com/users/dgearhart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgearhart/subscriptions","organizations_url":"https://api.github.com/users/dgearhart/orgs","repos_url":"https://api.github.com/users/dgearhart/repos","events_url":"https://api.github.com/users/dgearhart/events{/privacy}","received_events_url":"https://api.github.com/users/dgearhart/received_events","type":"User","site_admin":false},"body":"Are these needed? Can update controller in just one loop","created_at":"2016-12-08T21:29:26Z","updated_at":"2016-12-08T21:29:26Z","html_url":"https://github.com/valhalla/thor/pull/510#discussion_r91610739","pull_request_url":"https://api.github.com/repos/valhalla/thor/pulls/510","_links":{"self":{"href":"https://api.github.com/repos/valhalla/thor/pulls/comments/91610739"},"html":{"href":"https://github.com/valhalla/thor/pull/510#discussion_r91610739"},"pull_request":{"href":"https://api.github.com/repos/valhalla/thor/pulls/510"}}},"pull_request":{"url":"https://api.github.com/repos/valhalla/thor/pulls/510","id":97201507,"html_url":"https://github.com/valhalla/thor/pull/510","diff_url":"https://github.com/valhalla/thor/pull/510.diff","patch_url":"https://github.com/valhalla/thor/pull/510.patch","issue_url":"https://api.github.com/repos/valhalla/thor/issues/510","number":510,"state":"open","locked":false,"title":"Added Filter Attributes & Shape Match Algorithm Choices","user":{"login":"kdiluca","id":12497844,"avatar_url":"https://avatars.githubusercontent.com/u/12497844?v=3","gravatar_id":"","url":"https://api.github.com/users/kdiluca","html_url":"https://github.com/kdiluca","followers_url":"https://api.github.com/users/kdiluca/followers","following_url":"https://api.github.com/users/kdiluca/following{/other_user}","gists_url":"https://api.github.com/users/kdiluca/gists{/gist_id}","starred_url":"https://api.github.com/users/kdiluca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdiluca/subscriptions","organizations_url":"https://api.github.com/users/kdiluca/orgs","repos_url":"https://api.github.com/users/kdiluca/repos","events_url":"https://api.github.com/users/kdiluca/events{/privacy}","received_events_url":"https://api.github.com/users/kdiluca/received_events","type":"User","site_admin":false},"body":"- Added capability to include/exclude the edge attributes\r\n- Added a string shape_match to choose which shape algorithm to run; either \"edge_walking\", \"map_snap\" (only runs map-matching) or \"walk_or_snap\" (runs edge_walking first and falls back to map_matching).\r\n- Serializes out the attributes from the trip_path proto based on the include/exclude parameters with default\r\n\r\nExample request:\r\n http://localhost:8002/trace_attributes?json={\"shape\":[{\"lat\":39.983841,\"lon\":-76.735741},{\"lat\":39.983704,\"lon\":-76.735298},{\"lat\":39.983578,\"lon\":-76.734848},{\"lat\":39.983551,\"lon\":-76.734253},{\"lat\":39.983555,\"lon\":-76.734116},{\"lat\":39.983589,\"lon\":-76.733315},{\"lat\":39.983719,\"lon\":-76.732445},{\"lat\":39.983818,\"lon\":-76.731712},{\"lat\":39.983776,\"lon\":-76.731506},{\"lat\":39.983696,\"lon\":-76.731369}],\"costing\":\"auto\",\"shape_match\":\"walk_or_snap\",\"filters\":{\"attributes\":[\"edge.names\",\"edge.id\", \"edge.weighted_grade\",\"edge.speed\"],\"action\":\"only\"}}","created_at":"2016-12-08T21:11:18Z","updated_at":"2016-12-08T21:29:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba3c4be6e7b5a3528773f0b52a4688ec91562416","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/valhalla/thor/pulls/510/commits","review_comments_url":"https://api.github.com/repos/valhalla/thor/pulls/510/comments","review_comment_url":"https://api.github.com/repos/valhalla/thor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/valhalla/thor/issues/510/comments","statuses_url":"https://api.github.com/repos/valhalla/thor/statuses/b010f1048873b1e1538385f69924dafee227bad6","head":{"label":"valhalla:kdiluca","ref":"kdiluca","sha":"b010f1048873b1e1538385f69924dafee227bad6","user":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars.githubusercontent.com/u/10232331?v=3","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"repo":{"id":28186592,"name":"thor","full_name":"valhalla/thor","owner":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars.githubusercontent.com/u/10232331?v=3","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/valhalla/thor","description":"Tiled Hierarchical Open Routing - a routing engine backed by tiled open source routing data","fork":false,"url":"https://api.github.com/repos/valhalla/thor","forks_url":"https://api.github.com/repos/valhalla/thor/forks","keys_url":"https://api.github.com/repos/valhalla/thor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/valhalla/thor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/valhalla/thor/teams","hooks_url":"https://api.github.com/repos/valhalla/thor/hooks","issue_events_url":"https://api.github.com/repos/valhalla/thor/issues/events{/number}","events_url":"https://api.github.com/repos/valhalla/thor/events","assignees_url":"https://api.github.com/repos/valhalla/thor/assignees{/user}","branches_url":"https://api.github.com/repos/valhalla/thor/branches{/branch}","tags_url":"https://api.github.com/repos/valhalla/thor/tags","blobs_url":"https://api.github.com/repos/valhalla/thor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/valhalla/thor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/valhalla/thor/git/refs{/sha}","trees_url":"https://api.github.com/repos/valhalla/thor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/valhalla/thor/statuses/{sha}","languages_url":"https://api.github.com/repos/valhalla/thor/languages","stargazers_url":"https://api.github.com/repos/valhalla/thor/stargazers","contributors_url":"https://api.github.com/repos/valhalla/thor/contributors","subscribers_url":"https://api.github.com/repos/valhalla/thor/subscribers","subscription_url":"https://api.github.com/repos/valhalla/thor/subscription","commits_url":"https://api.github.com/repos/valhalla/thor/commits{/sha}","git_commits_url":"https://api.github.com/repos/valhalla/thor/git/commits{/sha}","comments_url":"https://api.github.com/repos/valhalla/thor/comments{/number}","issue_comment_url":"https://api.github.com/repos/valhalla/thor/issues/comments{/number}","contents_url":"https://api.github.com/repos/valhalla/thor/contents/{+path}","compare_url":"https://api.github.com/repos/valhalla/thor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/valhalla/thor/merges","archive_url":"https://api.github.com/repos/valhalla/thor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/valhalla/thor/downloads","issues_url":"https://api.github.com/repos/valhalla/thor/issues{/number}","pulls_url":"https://api.github.com/repos/valhalla/thor/pulls{/number}","milestones_url":"https://api.github.com/repos/valhalla/thor/milestones{/number}","notifications_url":"https://api.github.com/repos/valhalla/thor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/valhalla/thor/labels{/name}","releases_url":"https://api.github.com/repos/valhalla/thor/releases{/id}","deployments_url":"https://api.github.com/repos/valhalla/thor/deployments","created_at":"2014-12-18T14:25:42Z","updated_at":"2016-11-29T04:15:59Z","pushed_at":"2016-12-08T21:11:18Z","git_url":"git://github.com/valhalla/thor.git","ssh_url":"git@github.com:valhalla/thor.git","clone_url":"https://github.com/valhalla/thor.git","svn_url":"https://github.com/valhalla/thor","homepage":null,"size":9809,"stargazers_count":106,"watchers_count":106,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":24,"forks":21,"open_issues":24,"watchers":106,"default_branch":"master"}},"base":{"label":"valhalla:master","ref":"master","sha":"4daa5af0969b2bc81393aa398f9d346fa8321608","user":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars.githubusercontent.com/u/10232331?v=3","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"repo":{"id":28186592,"name":"thor","full_name":"valhalla/thor","owner":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars.githubusercontent.com/u/10232331?v=3","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/valhalla/thor","description":"Tiled Hierarchical Open Routing - a routing engine backed by tiled open source routing data","fork":false,"url":"https://api.github.com/repos/valhalla/thor","forks_url":"https://api.github.com/repos/valhalla/thor/forks","keys_url":"https://api.github.com/repos/valhalla/thor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/valhalla/thor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/valhalla/thor/teams","hooks_url":"https://api.github.com/repos/valhalla/thor/hooks","issue_events_url":"https://api.github.com/repos/valhalla/thor/issues/events{/number}","events_url":"https://api.github.com/repos/valhalla/thor/events","assignees_url":"https://api.github.com/repos/valhalla/thor/assignees{/user}","branches_url":"https://api.github.com/repos/valhalla/thor/branches{/branch}","tags_url":"https://api.github.com/repos/valhalla/thor/tags","blobs_url":"https://api.github.com/repos/valhalla/thor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/valhalla/thor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/valhalla/thor/git/refs{/sha}","trees_url":"https://api.github.com/repos/valhalla/thor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/valhalla/thor/statuses/{sha}","languages_url":"https://api.github.com/repos/valhalla/thor/languages","stargazers_url":"https://api.github.com/repos/valhalla/thor/stargazers","contributors_url":"https://api.github.com/repos/valhalla/thor/contributors","subscribers_url":"https://api.github.com/repos/valhalla/thor/subscribers","subscription_url":"https://api.github.com/repos/valhalla/thor/subscription","commits_url":"https://api.github.com/repos/valhalla/thor/commits{/sha}","git_commits_url":"https://api.github.com/repos/valhalla/thor/git/commits{/sha}","comments_url":"https://api.github.com/repos/valhalla/thor/comments{/number}","issue_comment_url":"https://api.github.com/repos/valhalla/thor/issues/comments{/number}","contents_url":"https://api.github.com/repos/valhalla/thor/contents/{+path}","compare_url":"https://api.github.com/repos/valhalla/thor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/valhalla/thor/merges","archive_url":"https://api.github.com/repos/valhalla/thor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/valhalla/thor/downloads","issues_url":"https://api.github.com/repos/valhalla/thor/issues{/number}","pulls_url":"https://api.github.com/repos/valhalla/thor/pulls{/number}","milestones_url":"https://api.github.com/repos/valhalla/thor/milestones{/number}","notifications_url":"https://api.github.com/repos/valhalla/thor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/valhalla/thor/labels{/name}","releases_url":"https://api.github.com/repos/valhalla/thor/releases{/id}","deployments_url":"https://api.github.com/repos/valhalla/thor/deployments","created_at":"2014-12-18T14:25:42Z","updated_at":"2016-11-29T04:15:59Z","pushed_at":"2016-12-08T21:11:18Z","git_url":"git://github.com/valhalla/thor.git","ssh_url":"git@github.com:valhalla/thor.git","clone_url":"https://github.com/valhalla/thor.git","svn_url":"https://github.com/valhalla/thor","homepage":null,"size":9809,"stargazers_count":106,"watchers_count":106,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":24,"forks":21,"open_issues":24,"watchers":106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/valhalla/thor/pulls/510"},"html":{"href":"https://github.com/valhalla/thor/pull/510"},"issue":{"href":"https://api.github.com/repos/valhalla/thor/issues/510"},"comments":{"href":"https://api.github.com/repos/valhalla/thor/issues/510/comments"},"review_comments":{"href":"https://api.github.com/repos/valhalla/thor/pulls/510/comments"},"review_comment":{"href":"https://api.github.com/repos/valhalla/thor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/valhalla/thor/pulls/510/commits"},"statuses":{"href":"https://api.github.com/repos/valhalla/thor/statuses/b010f1048873b1e1538385f69924dafee227bad6"}}}}
{"actor":{"display_login":"dgearhart"}}