[postgis-users] ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

Regina Obe lr at pcorp.us
Thu Jan 19 00:06:05 PST 2017


Shira,

 

No clue and haven't looked at the code to see the difference.

 

The only thing I would guess is maybe in 2.0.1 if a pixel was only partially covered by a geometry then it doesn't include the pixel (thus the pixels you may be missing in 2.0.1 are those only partially covered by the geometry)

And in 2.3, maybe it includes it if it's partially covered.

 

I think we had discussions about that and if we needed another argument to denote which behavior should be used.  I forget what was decided if anything.

 

Hope that helps,

Regina

 

 

 

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Shira Bezalel
Sent: Wednesday, January 18, 2017 2:20 PM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: Re: [postgis-users] ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

 

 

On Mon, Jan 9, 2017 at 10:18 AM, Shira Bezalel <shira at sfei.org <mailto:shira at sfei.org> > wrote:

Hi there. I'm testing an upgraded database and seeing different results in a query that's using the ST_Clip function. 

 

old database: PostgreSQL 9.1.14 with PostGIS 2.0.1

new database: PostgreSQL: 9.6.1 with PostGIS 2.3.1

 

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. 

 

Query:

 

SELECT (pvc).value, SUM((pvc).count) AS total  

       FROM ( 

           SELECT ST_ValueCount(st_clip(rast, c.the_geom),1) AS pvc  

           FROM nlcdcal20_2011, counties c

           WHERE st_intersects(rast, c.the_geom) and 

           c.NAME = 'Alameda'  

       ) AS foo  

       GROUP BY (pvc).value        

       order by (pvc).value

 

If I remove the clip, the results are identical.

 

In terms of the actual difference, here's the sum total of all pixels found by this query:

 

Total pixels in 2.0.1 = 2,362,444

Total pixels in 2.3.1 = 

​​

2,418,017

 

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.

 

Thank you for any insight you can provide.

Shira

 

p.s. The faster performance of the new ST_Clip is awesome! 

 

 

​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?

 

Thank you,

Shira​

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170119/b55c0f5d/attachment.html>


More information about the postgis-users mailing list