{"action":"opened","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/issues/240","repository_url":"https://api.github.com/repos/CartoDB/cartodb-postgresql","labels_url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/issues/240/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/issues/240/events","html_url":"https://github.com/CartoDB/cartodb-postgresql/issues/240","id":150553220,"number":240,"title":"Overview clusters should be adusted to pixel centers","user":{"login":"jgoizueta","id":5909,"avatar_url":"https://avatars.githubusercontent.com/u/5909?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoizueta","html_url":"https://github.com/jgoizueta","followers_url":"https://api.github.com/users/jgoizueta/followers","following_url":"https://api.github.com/users/jgoizueta/following{/other_user}","gists_url":"https://api.github.com/users/jgoizueta/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoizueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoizueta/subscriptions","organizations_url":"https://api.github.com/users/jgoizueta/orgs","repos_url":"https://api.github.com/users/jgoizueta/repos","events_url":"https://api.github.com/users/jgoizueta/events{/privacy}","received_events_url":"https://api.github.com/users/jgoizueta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/CartoDB/cartodb-postgresql/labels/Data-services","name":"Data-services","color":"fef2c0"}],"state":"open","locked":false,"assignee":{"login":"jgoizueta","id":5909,"avatar_url":"https://avatars.githubusercontent.com/u/5909?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoizueta","html_url":"https://github.com/jgoizueta","followers_url":"https://api.github.com/users/jgoizueta/followers","following_url":"https://api.github.com/users/jgoizueta/following{/other_user}","gists_url":"https://api.github.com/users/jgoizueta/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoizueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoizueta/subscriptions","organizations_url":"https://api.github.com/users/jgoizueta/orgs","repos_url":"https://api.github.com/users/jgoizueta/repos","events_url":"https://api.github.com/users/jgoizueta/events{/privacy}","received_events_url":"https://api.github.com/users/jgoizueta/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2016-04-23T13:00:10Z","updated_at":"2016-04-23T13:00:10Z","closed_at":null,"body":"Overviews can be generated with a `tolerance_px` parameter that clusters points to a pixel-based grid based on the webmercator tiles that the tiler (Windshaft) renders.\r\n\r\nWhen TWKB is used by the tiler (to minimize the size of the data transfered from the database)\r\nthe coordinates are rounded to some number of decimals that by default are enough to address\r\neach pixels uniquely (the least-significant-digit of the rounded coordinates are smaller than a pixel;\r\nbut this can be controlled by the [`twkb_rounding_adjustment`](https://github.com/CartoDB/mapnik/tree/2.3.x.cartodb/plugins/input/postgis#23xcartodb) parameter).\r\n\r\nIf the pixel-adjusted coordinates are not computed at the center of pixels, artifacts as in the image (specially noticeable when the grid's size is 2 pixels) can occur even when the TWKB coordinates have subpixel precision:\r\n\r\n![tile_14_4824_6157_bad](https://cloud.githubusercontent.com/assets/5909/14761496/841fa602-0963-11e6-9fd7-fdc66970ceab.png)\r\n\r\n\r\nThese artefacts can be eliminated by forcing the point coordinates (before TWKB’s rounding) to lie at pixel’s centres. This would work with TWKB for any `twkb_rounding_adjustment` less than 0.5.\r\n\r\nCurrently coordinates were computed at the cell’s centres; for for cells made up of an exact, odd number of pixels (`tolerance_px`) the point was already at a pixel’s centre and no artefacts were produced; for cells made up of an exact, even number of pixels the points lied in between pixels and the effect was most noticeable."}}