{"action":"created","comment":{"url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/comments/141614513","pull_request_review_id":65855157,"id":141614513,"diff_hunk":"@@ -0,0 +1,77 @@\n+var Timer = require('../../stats/timer');\n+var debug = require('debug')('windshaft:renderer:pg_mvt');\n+var SubstitutionTokens = require('../../utils/substitution_tokens');\n+var geojsonUtils = require('../../utils/geojson_utils');\n+\n+/// CLASS: pg_mvt Renderer\n+//\n+/// A renderer for a given MapConfig layer\n+///\n+function Renderer(layers, sql, attrs, options) {\n+    options = options || {};\n+\n+    this.sql = sql;\n+    this.attrs = attrs;\n+    this.layers = layers;\n+\n+    this.tile_size = options.tileSize || 256;\n+    this.tile_max_geosize = options.maxGeosize || 40075017; // earth circumference in webmercator 3857\n+    this.buffer_size = options.bufferSize || 0;\n+    this.mvt_extent = options.mvt_extent || 4096;\n+}\n+\n+module.exports = Renderer;\n+\n+\n+Renderer.prototype = {\n+    /// API: renders a tile with the Renderer configuration\n+    /// @param x tile x coordinate\n+    /// @param y tile y coordinate\n+    /// @param z tile zoom\n+    /// callback: will be called when done using nodejs protocol (err, data)\n+    getTile: function (z, x, y, callback) {\n+        var query = 'SELECT (';\n+        this.layers.forEach((layer, i) => {\n+            if (i >= 1) {\n+                query += ' || ';\n+            }\n+            var nonGeoColumns = geojsonUtils.getGeojsonProperties(layer.options).join(',');\n+            if (nonGeoColumns !== '') {","path":"lib/windshaft/renderers/pg_mvt/renderer.js","position":39,"original_position":39,"commit_id":"f6409638cb9e794774255cb794cb6c2e6fce937b","original_commit_id":"ff5ae340771e9fb180667128ad564d6614a3ff6b","user":{"login":"dv343","id":1692175,"avatar_url":"https://avatars2.githubusercontent.com/u/1692175?v=4","gravatar_id":"","url":"https://api.github.com/users/dv343","html_url":"https://github.com/dv343","followers_url":"https://api.github.com/users/dv343/followers","following_url":"https://api.github.com/users/dv343/following{/other_user}","gists_url":"https://api.github.com/users/dv343/gists{/gist_id}","starred_url":"https://api.github.com/users/dv343/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dv343/subscriptions","organizations_url":"https://api.github.com/users/dv343/orgs","repos_url":"https://api.github.com/users/dv343/repos","events_url":"https://api.github.com/users/dv343/events{/privacy}","received_events_url":"https://api.github.com/users/dv343/received_events","type":"User","site_admin":false},"body":"You are mixing now raw column names with SQL expressions, but Ok.","created_at":"2017-09-28T13:20:02Z","updated_at":"2017-09-28T13:20:02Z","html_url":"https://github.com/CartoDB/Windshaft/pull/561#discussion_r141614513","pull_request_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/comments/141614513"},"html":{"href":"https://github.com/CartoDB/Windshaft/pull/561#discussion_r141614513"},"pull_request":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561"}},"in_reply_to_id":141589849},"pull_request":{"url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561","id":143612021,"html_url":"https://github.com/CartoDB/Windshaft/pull/561","diff_url":"https://github.com/CartoDB/Windshaft/pull/561.diff","patch_url":"https://github.com/CartoDB/Windshaft/pull/561.patch","issue_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/561","number":561,"state":"open","locked":false,"title":"[DNM] PostgreSQL MVT path","user":{"login":"dv343","id":1692175,"avatar_url":"https://avatars2.githubusercontent.com/u/1692175?v=4","gravatar_id":"","url":"https://api.github.com/users/dv343","html_url":"https://github.com/dv343","followers_url":"https://api.github.com/users/dv343/followers","following_url":"https://api.github.com/users/dv343/following{/other_user}","gists_url":"https://api.github.com/users/dv343/gists{/gist_id}","starred_url":"https://api.github.com/users/dv343/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dv343/subscriptions","organizations_url":"https://api.github.com/users/dv343/orgs","repos_url":"https://api.github.com/users/dv343/repos","events_url":"https://api.github.com/users/dv343/events{/privacy}","received_events_url":"https://api.github.com/users/dv343/received_events","type":"User","site_admin":false},"body":"Adds a new path to generate MVT tiles without using Mapnik.\r\n\r\nThe new path needs PostGIS 2.4 since PostGIS is the one who generates the MVT tiles with the new path, with the St_AsMVT and St_AsMVTGeom functions.\r\n\r\nSince complying with this requisite could be problematic, and we may want to rollback to the old functionality, a flag is used to switch between the old mapnik path and this new one.\r\n\r\nThe flag is `opts.mvt.usePgSQL`, and it is passed to the constructor by the upper layers. If it doesn't exists it will default to the old path.\r\n\r\nDo not merge yet, since the tests are passing because they don't target the new functionality.","created_at":"2017-09-28T10:32:47Z","updated_at":"2017-09-28T13:20:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e184db7b1aac4593d3cbe119557c7ad3505ab037","assignee":{"login":"dv343","id":1692175,"avatar_url":"https://avatars2.githubusercontent.com/u/1692175?v=4","gravatar_id":"","url":"https://api.github.com/users/dv343","html_url":"https://github.com/dv343","followers_url":"https://api.github.com/users/dv343/followers","following_url":"https://api.github.com/users/dv343/following{/other_user}","gists_url":"https://api.github.com/users/dv343/gists{/gist_id}","starred_url":"https://api.github.com/users/dv343/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dv343/subscriptions","organizations_url":"https://api.github.com/users/dv343/orgs","repos_url":"https://api.github.com/users/dv343/repos","events_url":"https://api.github.com/users/dv343/events{/privacy}","received_events_url":"https://api.github.com/users/dv343/received_events","type":"User","site_admin":false},"assignees":[{"login":"dv343","id":1692175,"avatar_url":"https://avatars2.githubusercontent.com/u/1692175?v=4","gravatar_id":"","url":"https://api.github.com/users/dv343","html_url":"https://github.com/dv343","followers_url":"https://api.github.com/users/dv343/followers","following_url":"https://api.github.com/users/dv343/following{/other_user}","gists_url":"https://api.github.com/users/dv343/gists{/gist_id}","starred_url":"https://api.github.com/users/dv343/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dv343/subscriptions","organizations_url":"https://api.github.com/users/dv343/orgs","repos_url":"https://api.github.com/users/dv343/repos","events_url":"https://api.github.com/users/dv343/events{/privacy}","received_events_url":"https://api.github.com/users/dv343/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"rafatower","id":1914276,"avatar_url":"https://avatars1.githubusercontent.com/u/1914276?v=4","gravatar_id":"","url":"https://api.github.com/users/rafatower","html_url":"https://github.com/rafatower","followers_url":"https://api.github.com/users/rafatower/followers","following_url":"https://api.github.com/users/rafatower/following{/other_user}","gists_url":"https://api.github.com/users/rafatower/gists{/gist_id}","starred_url":"https://api.github.com/users/rafatower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafatower/subscriptions","organizations_url":"https://api.github.com/users/rafatower/orgs","repos_url":"https://api.github.com/users/rafatower/repos","events_url":"https://api.github.com/users/rafatower/events{/privacy}","received_events_url":"https://api.github.com/users/rafatower/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561/commits","review_comments_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561/comments","review_comment_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/561/comments","statuses_url":"https://api.github.com/repos/CartoDB/Windshaft/statuses/f6409638cb9e794774255cb794cb6c2e6fce937b","head":{"label":"CartoDB:MVTusedColumnsOnly-fix","ref":"MVTusedColumnsOnly-fix","sha":"f6409638cb9e794774255cb794cb6c2e6fce937b","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars0.githubusercontent.com/u/1799254?v=4","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2303178,"name":"Windshaft","full_name":"CartoDB/Windshaft","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars0.githubusercontent.com/u/1799254?v=4","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/Windshaft","description":"A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling","fork":false,"url":"https://api.github.com/repos/CartoDB/Windshaft","forks_url":"https://api.github.com/repos/CartoDB/Windshaft/forks","keys_url":"https://api.github.com/repos/CartoDB/Windshaft/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/Windshaft/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/Windshaft/teams","hooks_url":"https://api.github.com/repos/CartoDB/Windshaft/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/Windshaft/events","assignees_url":"https://api.github.com/repos/CartoDB/Windshaft/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/Windshaft/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/Windshaft/tags","blobs_url":"https://api.github.com/repos/CartoDB/Windshaft/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/Windshaft/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/Windshaft/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/Windshaft/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/Windshaft/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/Windshaft/languages","stargazers_url":"https://api.github.com/repos/CartoDB/Windshaft/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/Windshaft/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/Windshaft/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/Windshaft/subscription","commits_url":"https://api.github.com/repos/CartoDB/Windshaft/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/Windshaft/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/Windshaft/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/Windshaft/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/Windshaft/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/Windshaft/merges","archive_url":"https://api.github.com/repos/CartoDB/Windshaft/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/Windshaft/downloads","issues_url":"https://api.github.com/repos/CartoDB/Windshaft/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/Windshaft/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/Windshaft/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/Windshaft/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/Windshaft/releases{/id}","deployments_url":"https://api.github.com/repos/CartoDB/Windshaft/deployments","created_at":"2011-08-31T18:16:27Z","updated_at":"2017-09-04T05:22:27Z","pushed_at":"2017-09-28T13:16:52Z","git_url":"git://github.com/CartoDB/Windshaft.git","ssh_url":"git@github.com:CartoDB/Windshaft.git","clone_url":"https://github.com/CartoDB/Windshaft.git","svn_url":"https://github.com/CartoDB/Windshaft","homepage":"","size":5348,"stargazers_count":233,"watchers_count":233,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":62,"mirror_url":null,"open_issues_count":56,"forks":62,"open_issues":56,"watchers":233,"default_branch":"master"}},"base":{"label":"CartoDB:master","ref":"master","sha":"dc8ec8cc5e7648a709235a818da1b3b20edd60bf","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars0.githubusercontent.com/u/1799254?v=4","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2303178,"name":"Windshaft","full_name":"CartoDB/Windshaft","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars0.githubusercontent.com/u/1799254?v=4","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/Windshaft","description":"A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling","fork":false,"url":"https://api.github.com/repos/CartoDB/Windshaft","forks_url":"https://api.github.com/repos/CartoDB/Windshaft/forks","keys_url":"https://api.github.com/repos/CartoDB/Windshaft/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/Windshaft/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/Windshaft/teams","hooks_url":"https://api.github.com/repos/CartoDB/Windshaft/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/Windshaft/events","assignees_url":"https://api.github.com/repos/CartoDB/Windshaft/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/Windshaft/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/Windshaft/tags","blobs_url":"https://api.github.com/repos/CartoDB/Windshaft/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/Windshaft/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/Windshaft/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/Windshaft/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/Windshaft/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/Windshaft/languages","stargazers_url":"https://api.github.com/repos/CartoDB/Windshaft/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/Windshaft/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/Windshaft/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/Windshaft/subscription","commits_url":"https://api.github.com/repos/CartoDB/Windshaft/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/Windshaft/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/Windshaft/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/Windshaft/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/Windshaft/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/Windshaft/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/Windshaft/merges","archive_url":"https://api.github.com/repos/CartoDB/Windshaft/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/Windshaft/downloads","issues_url":"https://api.github.com/repos/CartoDB/Windshaft/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/Windshaft/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/Windshaft/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/Windshaft/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/Windshaft/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/Windshaft/releases{/id}","deployments_url":"https://api.github.com/repos/CartoDB/Windshaft/deployments","created_at":"2011-08-31T18:16:27Z","updated_at":"2017-09-04T05:22:27Z","pushed_at":"2017-09-28T13:16:52Z","git_url":"git://github.com/CartoDB/Windshaft.git","ssh_url":"git@github.com:CartoDB/Windshaft.git","clone_url":"https://github.com/CartoDB/Windshaft.git","svn_url":"https://github.com/CartoDB/Windshaft","homepage":"","size":5348,"stargazers_count":233,"watchers_count":233,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":62,"mirror_url":null,"open_issues_count":56,"forks":62,"open_issues":56,"watchers":233,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561"},"html":{"href":"https://github.com/CartoDB/Windshaft/pull/561"},"issue":{"href":"https://api.github.com/repos/CartoDB/Windshaft/issues/561"},"comments":{"href":"https://api.github.com/repos/CartoDB/Windshaft/issues/561/comments"},"review_comments":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561/comments"},"review_comment":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CartoDB/Windshaft/pulls/561/commits"},"statuses":{"href":"https://api.github.com/repos/CartoDB/Windshaft/statuses/f6409638cb9e794774255cb794cb6c2e6fce937b"}},"author_association":"NONE"}}
{"actor":{"display_login":"dv343"}}