{"action":"created","comment":{"url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/comments/39864851","id":39864851,"diff_hunk":"@@ -105,8 +108,13 @@ BEGIN\n                                     'hostel', 'hotel', 'motel', 'museum')\n                    OR railway_val IN ('subway_entrance')) THEN 17\n              WHEN (amenity_val IN ('bench', 'waste_basket')) THEN 18\n-             ELSE NULL END\n-    );\n+             ELSE NULL END;\n+  RETURN (CASE\n+    WHEN way_area > 1.0e7 THEN zoom - 4\n+    WHEN way_area > 1.0e6 THEN zoom - 3\n+    WHEN way_area > 1.0e5 THEN zoom - 2\n+    WHEN way_area > 1.0e4 THEN zoom - 1\n+    ELSE zoom END);","path":"data/functions.sql","position":31,"original_position":31,"commit_id":"45025a5a6ffc9a3daae82b483225e1a78813f7c3","original_commit_id":"45025a5a6ffc9a3daae82b483225e1a78813f7c3","user":{"login":"rmarianski","id":53770,"avatar_url":"https://avatars.githubusercontent.com/u/53770?v=3","gravatar_id":"","url":"https://api.github.com/users/rmarianski","html_url":"https://github.com/rmarianski","followers_url":"https://api.github.com/users/rmarianski/followers","following_url":"https://api.github.com/users/rmarianski/following{/other_user}","gists_url":"https://api.github.com/users/rmarianski/gists{/gist_id}","starred_url":"https://api.github.com/users/rmarianski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmarianski/subscriptions","organizations_url":"https://api.github.com/users/rmarianski/orgs","repos_url":"https://api.github.com/users/rmarianski/repos","events_url":"https://api.github.com/users/rmarianski/events{/privacy}","received_events_url":"https://api.github.com/users/rmarianski/received_events","type":"User","site_admin":false},"body":"We'll probably want to update the `start_zoom` in queries.yaml to reflect the lowest possible zoom level that we can return here now.\r\n","created_at":"2015-09-18T15:08:07Z","updated_at":"2015-09-18T15:08:07Z","html_url":"https://github.com/mapzen/vector-datasource/pull/222#discussion_r39864851","pull_request_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222","_links":{"self":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/comments/39864851"},"html":{"href":"https://github.com/mapzen/vector-datasource/pull/222#discussion_r39864851"},"pull_request":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222"}}},"pull_request":{"url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222","id":45414481,"html_url":"https://github.com/mapzen/vector-datasource/pull/222","diff_url":"https://github.com/mapzen/vector-datasource/pull/222.diff","patch_url":"https://github.com/mapzen/vector-datasource/pull/222.patch","issue_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/222","number":222,"state":"open","locked":false,"title":"Extract POIs from polygons and filter zoom by area.","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":"Previously, the POIs had just been coming from the `planet_osm_point` table, but some POIs are represented as polygons. These are included via their centroid, and the same test function `mz_calculate_poi_level`.\r\n\r\nThat function has been modified to adjust the zoom based on the feature's area. Note that this will probably mean we want to take another look at the zoom levels that some of these get assigned in the function and adjust based on the distribution of areas for those feature types.\r\n\r\nFinally, the `mz_calculate_poi_level` function gets called almost a million times for a mid-zoom tile and, even though it's pretty quick, that's just too slow. The POI `min_zoom` is reified as a column in both the points and polygons tables and kept up to date with a trigger (yuck...). That brings the query time for a mid-zoom tile down from 4s to about 5ms.\r\n\r\nRefs #195.\r\n\r\n@rmarianski could you review, please?","created_at":"2015-09-18T14:46:42Z","updated_at":"2015-09-18T15:08:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3661ff8e2dcac8c7790d92ad66694d2e7a8b7a9","assignee":{"login":"rmarianski","id":53770,"avatar_url":"https://avatars.githubusercontent.com/u/53770?v=3","gravatar_id":"","url":"https://api.github.com/users/rmarianski","html_url":"https://github.com/rmarianski","followers_url":"https://api.github.com/users/rmarianski/followers","following_url":"https://api.github.com/users/rmarianski/following{/other_user}","gists_url":"https://api.github.com/users/rmarianski/gists{/gist_id}","starred_url":"https://api.github.com/users/rmarianski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmarianski/subscriptions","organizations_url":"https://api.github.com/users/rmarianski/orgs","repos_url":"https://api.github.com/users/rmarianski/repos","events_url":"https://api.github.com/users/rmarianski/events{/privacy}","received_events_url":"https://api.github.com/users/rmarianski/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222/commits","review_comments_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222/comments","review_comment_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/222/comments","statuses_url":"https://api.github.com/repos/mapzen/vector-datasource/statuses/45025a5a6ffc9a3daae82b483225e1a78813f7c3","head":{"label":"mapzen:195-filter-poi-zoom-by-area","ref":"195-filter-poi-zoom-by-area","sha":"45025a5a6ffc9a3daae82b483225e1a78813f7c3","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":13446739,"name":"vector-datasource","full_name":"mapzen/vector-datasource","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/vector-datasource","description":"Mapzen vector tile service - OpenStreetMap vector tiles in several formats","fork":false,"url":"https://api.github.com/repos/mapzen/vector-datasource","forks_url":"https://api.github.com/repos/mapzen/vector-datasource/forks","keys_url":"https://api.github.com/repos/mapzen/vector-datasource/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapzen/vector-datasource/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapzen/vector-datasource/teams","hooks_url":"https://api.github.com/repos/mapzen/vector-datasource/hooks","issue_events_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/events{/number}","events_url":"https://api.github.com/repos/mapzen/vector-datasource/events","assignees_url":"https://api.github.com/repos/mapzen/vector-datasource/assignees{/user}","branches_url":"https://api.github.com/repos/mapzen/vector-datasource/branches{/branch}","tags_url":"https://api.github.com/repos/mapzen/vector-datasource/tags","blobs_url":"https://api.github.com/repos/mapzen/vector-datasource/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapzen/vector-datasource/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapzen/vector-datasource/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapzen/vector-datasource/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapzen/vector-datasource/statuses/{sha}","languages_url":"https://api.github.com/repos/mapzen/vector-datasource/languages","stargazers_url":"https://api.github.com/repos/mapzen/vector-datasource/stargazers","contributors_url":"https://api.github.com/repos/mapzen/vector-datasource/contributors","subscribers_url":"https://api.github.com/repos/mapzen/vector-datasource/subscribers","subscription_url":"https://api.github.com/repos/mapzen/vector-datasource/subscription","commits_url":"https://api.github.com/repos/mapzen/vector-datasource/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapzen/vector-datasource/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapzen/vector-datasource/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapzen/vector-datasource/contents/{+path}","compare_url":"https://api.github.com/repos/mapzen/vector-datasource/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapzen/vector-datasource/merges","archive_url":"https://api.github.com/repos/mapzen/vector-datasource/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapzen/vector-datasource/downloads","issues_url":"https://api.github.com/repos/mapzen/vector-datasource/issues{/number}","pulls_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls{/number}","milestones_url":"https://api.github.com/repos/mapzen/vector-datasource/milestones{/number}","notifications_url":"https://api.github.com/repos/mapzen/vector-datasource/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapzen/vector-datasource/labels{/name}","releases_url":"https://api.github.com/repos/mapzen/vector-datasource/releases{/id}","created_at":"2013-10-09T15:54:45Z","updated_at":"2015-09-17T14:35:02Z","pushed_at":"2015-09-18T14:46:42Z","git_url":"git://github.com/mapzen/vector-datasource.git","ssh_url":"git@github.com:mapzen/vector-datasource.git","clone_url":"https://github.com/mapzen/vector-datasource.git","svn_url":"https://github.com/mapzen/vector-datasource","homepage":"http://mapzen.com/vector","size":75278,"stargazers_count":158,"watchers_count":158,"language":"PLpgSQL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":46,"forks":37,"open_issues":46,"watchers":158,"default_branch":"master"}},"base":{"label":"mapzen:master","ref":"master","sha":"8c8e28df0986b4c5c2549a3ab4232315d5b160aa","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":13446739,"name":"vector-datasource","full_name":"mapzen/vector-datasource","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/vector-datasource","description":"Mapzen vector tile service - OpenStreetMap vector tiles in several formats","fork":false,"url":"https://api.github.com/repos/mapzen/vector-datasource","forks_url":"https://api.github.com/repos/mapzen/vector-datasource/forks","keys_url":"https://api.github.com/repos/mapzen/vector-datasource/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapzen/vector-datasource/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapzen/vector-datasource/teams","hooks_url":"https://api.github.com/repos/mapzen/vector-datasource/hooks","issue_events_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/events{/number}","events_url":"https://api.github.com/repos/mapzen/vector-datasource/events","assignees_url":"https://api.github.com/repos/mapzen/vector-datasource/assignees{/user}","branches_url":"https://api.github.com/repos/mapzen/vector-datasource/branches{/branch}","tags_url":"https://api.github.com/repos/mapzen/vector-datasource/tags","blobs_url":"https://api.github.com/repos/mapzen/vector-datasource/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapzen/vector-datasource/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapzen/vector-datasource/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapzen/vector-datasource/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapzen/vector-datasource/statuses/{sha}","languages_url":"https://api.github.com/repos/mapzen/vector-datasource/languages","stargazers_url":"https://api.github.com/repos/mapzen/vector-datasource/stargazers","contributors_url":"https://api.github.com/repos/mapzen/vector-datasource/contributors","subscribers_url":"https://api.github.com/repos/mapzen/vector-datasource/subscribers","subscription_url":"https://api.github.com/repos/mapzen/vector-datasource/subscription","commits_url":"https://api.github.com/repos/mapzen/vector-datasource/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapzen/vector-datasource/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapzen/vector-datasource/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapzen/vector-datasource/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapzen/vector-datasource/contents/{+path}","compare_url":"https://api.github.com/repos/mapzen/vector-datasource/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapzen/vector-datasource/merges","archive_url":"https://api.github.com/repos/mapzen/vector-datasource/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapzen/vector-datasource/downloads","issues_url":"https://api.github.com/repos/mapzen/vector-datasource/issues{/number}","pulls_url":"https://api.github.com/repos/mapzen/vector-datasource/pulls{/number}","milestones_url":"https://api.github.com/repos/mapzen/vector-datasource/milestones{/number}","notifications_url":"https://api.github.com/repos/mapzen/vector-datasource/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapzen/vector-datasource/labels{/name}","releases_url":"https://api.github.com/repos/mapzen/vector-datasource/releases{/id}","created_at":"2013-10-09T15:54:45Z","updated_at":"2015-09-17T14:35:02Z","pushed_at":"2015-09-18T14:46:42Z","git_url":"git://github.com/mapzen/vector-datasource.git","ssh_url":"git@github.com:mapzen/vector-datasource.git","clone_url":"https://github.com/mapzen/vector-datasource.git","svn_url":"https://github.com/mapzen/vector-datasource","homepage":"http://mapzen.com/vector","size":75278,"stargazers_count":158,"watchers_count":158,"language":"PLpgSQL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":46,"forks":37,"open_issues":46,"watchers":158,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222"},"html":{"href":"https://github.com/mapzen/vector-datasource/pull/222"},"issue":{"href":"https://api.github.com/repos/mapzen/vector-datasource/issues/222"},"comments":{"href":"https://api.github.com/repos/mapzen/vector-datasource/issues/222/comments"},"review_comments":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222/comments"},"review_comment":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapzen/vector-datasource/pulls/222/commits"},"statuses":{"href":"https://api.github.com/repos/mapzen/vector-datasource/statuses/45025a5a6ffc9a3daae82b483225e1a78813f7c3"}}}}