{"action":"created","comment":{"url":"https://api.github.com/repos/mapzen/TileStache/pulls/comments/43308952","id":43308952,"diff_hunk":"@@ -2067,47 +2137,51 @@ def remove_duplicate_features(\n     # features. we keep the geometry of the seen items too, so that\n     # we can tell if any new feature is significantly far enough\n     # away that it should be shown again.\n-    seen_items = dict()\n-\n-    def meters_to_pixels(distance):\n-        return distance * float(1 << (zoom + 8)) / 40075016.68\n-\n-    new_features = []\n-    for feature in layer['features']:\n-        shape, props, fid = feature\n-\n-        keep_feature = True\n-        if shape.geom_type in geometry_types:\n-            key = tuple([props.get(k) for k in property_keys])\n-            seen_geoms = seen_items.get(key)\n-\n-            if seen_geoms is None:\n-                # first time we've seen this item, so keep it in\n-                # the output.\n-                seen_items[key] = [shape]\n+    deduplicator = _Deduplicator(property_keys, min_distance,\n+                                 none_means_unique)\n+\n+    for source_layer in source_layers:\n+        layer_index = -1\n+        # because this post-processor can potentially modify\n+        # multiple layers, and that wasn't how the return value\n+        # system was designed, instead it modifies layers\n+        # *in-place*. this is abnormal, and as such requires a\n+        # nice big comment like this!","path":"TileStache/Goodies/VecTiles/transform.py","position":141,"original_position":141,"commit_id":"26f0c15c0425c1684bc2a162e404737a40b40f98","original_commit_id":"adf0f456d41d09af561c760f8454f484f7812042","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},"body":"Yup, having them return the complete new list sounds like a better option.","created_at":"2015-10-28T19:56:33Z","updated_at":"2015-10-28T19:56:33Z","html_url":"https://github.com/mapzen/TileStache/pull/85#discussion_r43308952","pull_request_url":"https://api.github.com/repos/mapzen/TileStache/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/comments/43308952"},"html":{"href":"https://github.com/mapzen/TileStache/pull/85#discussion_r43308952"},"pull_request":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/mapzen/TileStache/pulls/85","id":49039369,"html_url":"https://github.com/mapzen/TileStache/pull/85","diff_url":"https://github.com/mapzen/TileStache/pull/85.diff","patch_url":"https://github.com/mapzen/TileStache/pull/85.patch","issue_url":"https://api.github.com/repos/mapzen/TileStache/issues/85","number":85,"state":"open","locked":false,"title":"Made duplicate remove filter work across multiple layers","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},"body":"Extracted deduplicator to a class, makes logic easier to read. Allowed the duplicate remover to work across several layers. Requires a bit of abnormal fiddling with the layers to get it to work.\r\n\r\nBasically, the layers are mutable when passed in. For convenience, we can return a layer and it will be re-inserted into the layers list, but we're also passed the layer list as a parameter, so can do the modifications directly. This isn't exactly idiomatic, so there's a big comment explaining what's going on, and we might want to consider follow-up changes to make this sort of thing easier to reason about.\r\n\r\nConnects to mapzen/vector-datasource#266.\r\n\r\n@rmarianski could you review, please?\r\n","created_at":"2015-10-28T17:27:04Z","updated_at":"2015-10-28T19:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e070baf11a8bc761e5635fcb3df95b4353d2311","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapzen/TileStache/pulls/85/commits","review_comments_url":"https://api.github.com/repos/mapzen/TileStache/pulls/85/comments","review_comment_url":"https://api.github.com/repos/mapzen/TileStache/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapzen/TileStache/issues/85/comments","statuses_url":"https://api.github.com/repos/mapzen/TileStache/statuses/26f0c15c0425c1684bc2a162e404737a40b40f98","head":{"label":"mapzen:266-density-filter-pois","ref":"266-density-filter-pois","sha":"26f0c15c0425c1684bc2a162e404737a40b40f98","user":{"login":"mapzen","id":5435747,"avatar_url":"https://avatars.githubusercontent.com/u/5435747?v=3","gravatar_id":"","url":"https://api.github.com/users/mapzen","html_url":"https://github.com/mapzen","followers_url":"https://api.github.com/users/mapzen/followers","following_url":"https://api.github.com/users/mapzen/following{/other_user}","gists_url":"https://api.github.com/users/mapzen/gists{/gist_id}","starred_url":"https://api.github.com/users/mapzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapzen/subscriptions","organizations_url":"https://api.github.com/users/mapzen/orgs","repos_url":"https://api.github.com/users/mapzen/repos","events_url":"https://api.github.com/users/mapzen/events{/privacy}","received_events_url":"https://api.github.com/users/mapzen/received_events","type":"Organization","site_admin":false},"repo":{"id":16214517,"name":"TileStache","full_name":"mapzen/TileStache","owner":{"login":"mapzen","id":5435747,"avatar_url":"https://avatars.githubusercontent.com/u/5435747?v=3","gravatar_id":"","url":"https://api.github.com/users/mapzen","html_url":"https://github.com/mapzen","followers_url":"https://api.github.com/users/mapzen/followers","following_url":"https://api.github.com/users/mapzen/following{/other_user}","gists_url":"https://api.github.com/users/mapzen/gists{/gist_id}","starred_url":"https://api.github.com/users/mapzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapzen/subscriptions","organizations_url":"https://api.github.com/users/mapzen/orgs","repos_url":"https://api.github.com/users/mapzen/repos","events_url":"https://api.github.com/users/mapzen/events{/privacy}","received_events_url":"https://api.github.com/users/mapzen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapzen/TileStache","description":"A stylish alternative for caching your map tiles.","fork":true,"url":"https://api.github.com/repos/mapzen/TileStache","forks_url":"https://api.github.com/repos/mapzen/TileStache/forks","keys_url":"https://api.github.com/repos/mapzen/TileStache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapzen/TileStache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapzen/TileStache/teams","hooks_url":"https://api.github.com/repos/mapzen/TileStache/hooks","issue_events_url":"https://api.github.com/repos/mapzen/TileStache/issues/events{/number}","events_url":"https://api.github.com/repos/mapzen/TileStache/events","assignees_url":"https://api.github.com/repos/mapzen/TileStache/assignees{/user}","branches_url":"https://api.github.com/repos/mapzen/TileStache/branches{/branch}","tags_url":"https://api.github.com/repos/mapzen/TileStache/tags","blobs_url":"https://api.github.com/repos/mapzen/TileStache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapzen/TileStache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapzen/TileStache/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapzen/TileStache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapzen/TileStache/statuses/{sha}","languages_url":"https://api.github.com/repos/mapzen/TileStache/languages","stargazers_url":"https://api.github.com/repos/mapzen/TileStache/stargazers","contributors_url":"https://api.github.com/repos/mapzen/TileStache/contributors","subscribers_url":"https://api.github.com/repos/mapzen/TileStache/subscribers","subscription_url":"https://api.github.com/repos/mapzen/TileStache/subscription","commits_url":"https://api.github.com/repos/mapzen/TileStache/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapzen/TileStache/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapzen/TileStache/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapzen/TileStache/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapzen/TileStache/contents/{+path}","compare_url":"https://api.github.com/repos/mapzen/TileStache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapzen/TileStache/merges","archive_url":"https://api.github.com/repos/mapzen/TileStache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapzen/TileStache/downloads","issues_url":"https://api.github.com/repos/mapzen/TileStache/issues{/number}","pulls_url":"https://api.github.com/repos/mapzen/TileStache/pulls{/number}","milestones_url":"https://api.github.com/repos/mapzen/TileStache/milestones{/number}","notifications_url":"https://api.github.com/repos/mapzen/TileStache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapzen/TileStache/labels{/name}","releases_url":"https://api.github.com/repos/mapzen/TileStache/releases{/id}","created_at":"2014-01-24T19:28:51Z","updated_at":"2015-10-05T10:32:25Z","pushed_at":"2015-10-28T19:49:00Z","git_url":"git://github.com/mapzen/TileStache.git","ssh_url":"git@github.com:mapzen/TileStache.git","clone_url":"https://github.com/mapzen/TileStache.git","svn_url":"https://github.com/mapzen/TileStache","homepage":"http://tilestache.org","size":7032,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":14,"default_branch":"integration-1"}},"base":{"label":"mapzen:integration-1","ref":"integration-1","sha":"17f75c227158a23812f235fd94d3eef56df766ce","user":{"login":"mapzen","id":5435747,"avatar_url":"https://avatars.githubusercontent.com/u/5435747?v=3","gravatar_id":"","url":"https://api.github.com/users/mapzen","html_url":"https://github.com/mapzen","followers_url":"https://api.github.com/users/mapzen/followers","following_url":"https://api.github.com/users/mapzen/following{/other_user}","gists_url":"https://api.github.com/users/mapzen/gists{/gist_id}","starred_url":"https://api.github.com/users/mapzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapzen/subscriptions","organizations_url":"https://api.github.com/users/mapzen/orgs","repos_url":"https://api.github.com/users/mapzen/repos","events_url":"https://api.github.com/users/mapzen/events{/privacy}","received_events_url":"https://api.github.com/users/mapzen/received_events","type":"Organization","site_admin":false},"repo":{"id":16214517,"name":"TileStache","full_name":"mapzen/TileStache","owner":{"login":"mapzen","id":5435747,"avatar_url":"https://avatars.githubusercontent.com/u/5435747?v=3","gravatar_id":"","url":"https://api.github.com/users/mapzen","html_url":"https://github.com/mapzen","followers_url":"https://api.github.com/users/mapzen/followers","following_url":"https://api.github.com/users/mapzen/following{/other_user}","gists_url":"https://api.github.com/users/mapzen/gists{/gist_id}","starred_url":"https://api.github.com/users/mapzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapzen/subscriptions","organizations_url":"https://api.github.com/users/mapzen/orgs","repos_url":"https://api.github.com/users/mapzen/repos","events_url":"https://api.github.com/users/mapzen/events{/privacy}","received_events_url":"https://api.github.com/users/mapzen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapzen/TileStache","description":"A stylish alternative for caching your map tiles.","fork":true,"url":"https://api.github.com/repos/mapzen/TileStache","forks_url":"https://api.github.com/repos/mapzen/TileStache/forks","keys_url":"https://api.github.com/repos/mapzen/TileStache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapzen/TileStache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapzen/TileStache/teams","hooks_url":"https://api.github.com/repos/mapzen/TileStache/hooks","issue_events_url":"https://api.github.com/repos/mapzen/TileStache/issues/events{/number}","events_url":"https://api.github.com/repos/mapzen/TileStache/events","assignees_url":"https://api.github.com/repos/mapzen/TileStache/assignees{/user}","branches_url":"https://api.github.com/repos/mapzen/TileStache/branches{/branch}","tags_url":"https://api.github.com/repos/mapzen/TileStache/tags","blobs_url":"https://api.github.com/repos/mapzen/TileStache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapzen/TileStache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapzen/TileStache/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapzen/TileStache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapzen/TileStache/statuses/{sha}","languages_url":"https://api.github.com/repos/mapzen/TileStache/languages","stargazers_url":"https://api.github.com/repos/mapzen/TileStache/stargazers","contributors_url":"https://api.github.com/repos/mapzen/TileStache/contributors","subscribers_url":"https://api.github.com/repos/mapzen/TileStache/subscribers","subscription_url":"https://api.github.com/repos/mapzen/TileStache/subscription","commits_url":"https://api.github.com/repos/mapzen/TileStache/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapzen/TileStache/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapzen/TileStache/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapzen/TileStache/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapzen/TileStache/contents/{+path}","compare_url":"https://api.github.com/repos/mapzen/TileStache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapzen/TileStache/merges","archive_url":"https://api.github.com/repos/mapzen/TileStache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapzen/TileStache/downloads","issues_url":"https://api.github.com/repos/mapzen/TileStache/issues{/number}","pulls_url":"https://api.github.com/repos/mapzen/TileStache/pulls{/number}","milestones_url":"https://api.github.com/repos/mapzen/TileStache/milestones{/number}","notifications_url":"https://api.github.com/repos/mapzen/TileStache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapzen/TileStache/labels{/name}","releases_url":"https://api.github.com/repos/mapzen/TileStache/releases{/id}","created_at":"2014-01-24T19:28:51Z","updated_at":"2015-10-05T10:32:25Z","pushed_at":"2015-10-28T19:49:00Z","git_url":"git://github.com/mapzen/TileStache.git","ssh_url":"git@github.com:mapzen/TileStache.git","clone_url":"https://github.com/mapzen/TileStache.git","svn_url":"https://github.com/mapzen/TileStache","homepage":"http://tilestache.org","size":7032,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":14,"default_branch":"integration-1"}},"_links":{"self":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/85"},"html":{"href":"https://github.com/mapzen/TileStache/pull/85"},"issue":{"href":"https://api.github.com/repos/mapzen/TileStache/issues/85"},"comments":{"href":"https://api.github.com/repos/mapzen/TileStache/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapzen/TileStache/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/mapzen/TileStache/statuses/26f0c15c0425c1684bc2a162e404737a40b40f98"}}}}