Re: ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

shirabez

On Mon, Jan 9, 2017 at 10:18 AM, Shira Bezalel <[hidden email]> 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​

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

Regina Obe-2

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:[hidden email]] On Behalf Of Shira Bezalel
Sent: Wednesday, January 18, 2017 2:20 PM
To: PostGIS Users Discussion <[hidden email]>
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 <[hidden email]> 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​


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_Clip - Different results between PostGIS 2.0.1 and 2.3.1

shirabez
Thanks Regina. That does help.

Shira

On Thu, Jan 19, 2017 at 12:06 AM, Regina Obe <[hidden email]> wrote:

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:[hidden email]] On Behalf Of Shira Bezalel
Sent: Wednesday, January 18, 2017 2:20 PM
To: PostGIS Users Discussion <[hidden email]>
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 <[hidden email]> 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​


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users



--
Shira Bezalel 
Database Administrator & Desktop Support Manager
San Francisco Estuary Institute
Ph: 510-746-7304

 

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Loading...