<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 9, 2017 at 10:18 AM, Shira Bezalel <span dir="ltr"><<a href="mailto:shira@sfei.org" target="_blank">shira@sfei.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:tahoma,sans-serif">Hi there. I'm testing an upgraded database and seeing different results in a query that's using the ST_Clip function. </div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">old database: PostgreSQL 9.1.14 with PostGIS 2.0.1</div><div style="font-family:tahoma,sans-serif">new database: PostgreSQL: 9.6.1 with PostGIS 2.3.1</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">I know ST_Clip was rewritten in C in PostGIS 2.1. Could this be responsible for different results? Or did the clipping algorithm change? I consulted the docs, but didn't see anything noted to this effect. </div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Query:</div><div style="font-family:tahoma,sans-serif"><br></div><div><div style="font-family:tahoma,sans-serif">SELECT (pvc).value, SUM((pvc).count) AS total </div><div style="font-family:tahoma,sans-serif"> FROM ( </div><div style="font-family:tahoma,sans-serif"> SELECT ST_ValueCount(st_clip(rast, c.the_geom),1) AS pvc </div><div style="font-family:tahoma,sans-serif"> FROM nlcdcal20_2011, counties c</div><div style="font-family:tahoma,sans-serif"> WHERE st_intersects(rast, c.the_geom) and </div><div style="font-family:tahoma,sans-serif"> c.NAME = 'Alameda' </div><div style="font-family:tahoma,sans-serif"> ) AS foo </div><div style="font-family:tahoma,sans-serif"> GROUP BY (pvc).value </div><div style="font-family:tahoma,sans-serif"> order by (pvc).value</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">If I remove the clip, the results are identical.</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">In terms of the actual difference, here's the sum total of all pixels found by this query:</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Total pixels in 2.0.1 = 2,362,444<br></div><div><font face="tahoma, sans-serif">Total pixels in 2.3.1 = <div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline"></div>2,418,017</font></div><div><br></div><div>It's not a huge difference, but enough to be curious about. We can live with it, but it would just be nice to know the cause.</div><div><br></div><div>Thank you for any insight you can provide.</div><span class="gmail-HOEnZb"><font color="#888888"><div style="font-family:tahoma,sans-serif">Shira<br></div></font></span><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">p.s. The faster performance of the new ST_Clip is awesome! </div></div></div></blockquote><div> </div></div><br><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Didn't hear back from the list on this, so thought I'd resend. Just looking to know if anyone has run into this, what might be the cause, and maybe most importantly (and ideally), if the new results would be considered more accurate?</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Shira</div></div></div></div></div>
</div></div>