{"action":"created","issue":{"url":"https://api.github.com/repos/mapzen/TileStache/issues/111","labels_url":"https://api.github.com/repos/mapzen/TileStache/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/mapzen/TileStache/issues/111/comments","events_url":"https://api.github.com/repos/mapzen/TileStache/issues/111/events","html_url":"https://github.com/mapzen/TileStache/pull/111","id":125388487,"number":111,"title":"Merge road segments","user":{"login":"zerebubuth","id":271360,"avatar_url":"https://avatars.githubusercontent.com/u/271360?v=3","gravatar_id":"","url":"https://api.github.com/users/zerebubuth","html_url":"https://github.com/zerebubuth","followers_url":"https://api.github.com/users/zerebubuth/followers","following_url":"https://api.github.com/users/zerebubuth/following{/other_user}","gists_url":"https://api.github.com/users/zerebubuth/gists{/gist_id}","starred_url":"https://api.github.com/users/zerebubuth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zerebubuth/subscriptions","organizations_url":"https://api.github.com/users/zerebubuth/orgs","repos_url":"https://api.github.com/users/zerebubuth/repos","events_url":"https://api.github.com/users/zerebubuth/events{/privacy}","received_events_url":"https://api.github.com/users/zerebubuth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapzen/TileStache/labels/in%20review","name":"in review","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-07T12:51:53Z","updated_at":"2016-01-07T15:48:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mapzen/TileStache/pulls/111","html_url":"https://github.com/mapzen/TileStache/pull/111","diff_url":"https://github.com/mapzen/TileStache/pull/111.diff","patch_url":"https://github.com/mapzen/TileStache/pull/111.patch"},"body":"This adds functions to help reduce feature count and reduce tile size by merging similar road segments. There are two parts to this:\r\n\r\n1. Dropping unused properties. Many small sections of roads have different attributes; they can be bridges or tunnels, or have a different name. These attribute differences are an obstacle to merging features, and may not even be used lower than a certain zoom level. Functions have been added to allow both dropping and keeping (whitelisting) properties with a `where`-style filter on the feature itself.\r\n2. Merging lines with the same properties. This is done by collecting together all the lines having exactly the same properties apart from their `id`, and calling `linemerge` on them. Currently, merging other geometry types is not supported, although this could be added.\r\n\r\nPerformance impact: It seems as if the overall performance actually _improves_ with these functions enabled. For a simple test, running on my local machine, showing the time in seconds to completely download the TopoJSON tile:\r\n\r\n```\r\n  Z   Before ->    After (percent)\r\n 6     15.6 ->     15.6 (  0.2%)\r\n 7      7.8 ->      7.8 ( -0.3%)\r\n 8     22.4 ->     16.7 (-25.5%)\r\n 9     25.1 ->     21.5 (-14.4%)\r\n10     12.7 ->     10.0 (-20.9%)\r\n11      7.6 ->      6.0 (-21.2%)\r\n12      5.6 ->      4.9 (-12.4%)\r\n13      3.7 ->      3.4 ( -9.1%)\r\n14      4.2 ->      4.1 ( -3.6%)\r\n15      1.3 ->      1.3 ( -4.4%)\r\n16      0.6 ->      0.6 ( -0.9%)\r\n17      0.4 ->      0.4 (  2.8%)\r\n18      0.3 ->      0.3 ( -4.7%)\r\n```\r\n\r\nReduction is most pronounced where the file size has reduced, but note also that there's at least a +/- 5% jitter in the results and the benchmark was not comprehensive, so it's entirely possible that this overstates the benefits. For comparison, below is the table of (uncompressed) average file size for each zoom:\r\n\r\n```\r\n Z   Before ->    After (percent)\r\n 6  1907133 ->  1907106 ( -0.0%)\r\n 7   820762 ->   820762 ( -0.0%)\r\n 8  2332353 ->   557706 (-76.1%)\r\n 9  2005132 ->   857379 (-57.2%)\r\n10  1388260 ->   584272 (-57.9%)\r\n11   880505 ->   391521 (-55.5%)\r\n12   660666 ->   334758 (-49.3%)\r\n13   446421 ->   305935 (-31.5%)\r\n14   544032 ->   450352 (-17.2%)\r\n15   153456 ->   122791 (-20.0%)\r\n16    55012 ->    46835 (-14.9%)\r\n17    25747 ->    25747 (  0.0%)\r\n18    10932 ->    10932 (  0.0%)\r\n```\r\n\r\nConnects to mapzen/vector-datasource#358.\r\n\r\n@nvkelso, could you review, please?"},"comment":{"url":"https://api.github.com/repos/mapzen/TileStache/issues/comments/169702571","html_url":"https://github.com/mapzen/TileStache/pull/111#issuecomment-169702571","issue_url":"https://api.github.com/repos/mapzen/TileStache/issues/111","id":169702571,"user":{"login":"nvkelso","id":853051,"avatar_url":"https://avatars.githubusercontent.com/u/853051?v=3","gravatar_id":"","url":"https://api.github.com/users/nvkelso","html_url":"https://github.com/nvkelso","followers_url":"https://api.github.com/users/nvkelso/followers","following_url":"https://api.github.com/users/nvkelso/following{/other_user}","gists_url":"https://api.github.com/users/nvkelso/gists{/gist_id}","starred_url":"https://api.github.com/users/nvkelso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvkelso/subscriptions","organizations_url":"https://api.github.com/users/nvkelso/orgs","repos_url":"https://api.github.com/users/nvkelso/repos","events_url":"https://api.github.com/users/nvkelso/events{/privacy}","received_events_url":"https://api.github.com/users/nvkelso/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T15:48:28Z","updated_at":"2016-01-07T15:48:28Z","body":"LGTM"}}