Search Postgresql Archives

Re: Circles with circle() vs ST_Buffer() Equality equalities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Sorry, forget my questions.
I checked the differences between the 2 polygons too quickly.
Actually, I checked only some points and some attributes :

SELECT ST_Area(geometry), ST_Perimeter(geometry), ST_NPoints(ST_ExteriorRing(geometry))
FROM (
SELECT polygon(32, circle('POINT(1 2)'::geometry::point, 0.5::double precision))::geometry
UNION
SELECT ST_Buffer('POINT(1 2)'::geometry, 0.5::double precision)
) t(geometry)
;
      st_area      |   st_perimeter   | st_npoints
-------------------+------------------+------------
 0.780361288064513 | 3.13654849054594 |         33
 0.780361288064513 | 3.13654849054594 |         33
----------> exactly the same results with the 2 polygons
...

----------> But, NOT all the points are identical :

SELECT ST_AsText((g1).geom) FROM (
SELECT st_dumppoints(ST_ExteriorRing(geometry))
FROM (
SELECT polygon(32, circle('POINT(1 2)'::geometry::point, 0.5::double precision))::geometry
) t1(geometry)
)t11(g1)
EXCEPT
SELECT ST_AsText((g2).geom) FROM (
SELECT st_dumppoints(ST_ExteriorRing(geometry))
FROM (
SELECT ST_Buffer('POINT(1 2)'::geometry, 0.5::double precision)
) t2(geometry)
)t22(g2)
ORDER BY 1 ;
                 st_astext
-------------------------------------------
 POINT(0.509607359798385 1.90245483899194)
 POINT(0.509607359798385 2.09754516100806)
 POINT(0.538060233744357 2.19134171618254)
 POINT(0.584265193848727 1.7222148834902)
 POINT(0.584265193848727 2.2777851165098)
 POINT(0.646446609406726 1.64644660940673)
 POINT(0.646446609406726 2.35355339059327)
 POINT(0.722214883490199 1.58426519384873)
 POINT(0.722214883490199 2.41573480615127)
 POINT(0.808658283817455 1.53806023374436)
 POINT(0.808658283817455 2.46193976625564)
 POINT(0.902454838991936 1.50960735979838)
 POINT(0.902454838991936 2.49039264020162)
 POINT(1 2.5)
 POINT(1.46193976625564 2.19134171618254)
 POINT(1.49039264020162 2.09754516100806)
(16 lignes)

SELECT ST_AsText((g1).geom) FROM (
SELECT st_dumppoints(ST_ExteriorRing(geometry))
FROM (
SELECT ST_Buffer('POINT(1 2)'::geometry, 0.5::double precision)
) t1(geometry)
)t11(g1)
EXCEPT
SELECT ST_AsText((g2).geom) FROM (
SELECT st_dumppoints(ST_ExteriorRing(geometry))
FROM (
SELECT polygon(32, circle('POINT(1 2)'::geometry::point, 0.5::double precision))::geometry
) t2(geometry)
)t22(g2)
ORDER BY 1 ;
                 st_astext
-------------------------------------------
 POINT(0.509607359798384 2.09754516100806)
 POINT(0.509607359798385 1.90245483899193)
 POINT(0.538060233744356 2.19134171618254)
 POINT(0.584265193848726 2.2777851165098)
 POINT(0.584265193848728 1.7222148834902)
 POINT(0.646446609406725 2.35355339059327)
 POINT(0.646446609406727 1.64644660940673)
 POINT(0.722214883490197 2.41573480615127)
 POINT(0.7222148834902 1.58426519384873)
 POINT(0.808658283817453 2.46193976625564)
 POINT(0.808658283817456 1.53806023374436)
 POINT(0.902454838991934 2.49039264020161)
 POINT(0.902454838991937 1.50960735979838)
 POINT(0.999999999999998 2.5)
 POINT(1.46193976625564 2.19134171618255)
 POINT(1.49039264020161 2.09754516100807)
(16 lignes)

=> It is a bit weird, but it seems there are slight differences on some points.
For example :
POINT(1 2.5)   for   polygon(32, circle('POINT(1 2)'::geometry::point, 0.5::double precision))::geometry
and
POINT(0.999999999999998 2.5)   for   ST_Buffer('POINT(1 2)'::geometry, 0.5::double precision)

I guess it comes from rounding because the start point is not the same for the 2 polygons.


----- Météo-France -----
PALAYRET JACQUES
DCSC/MBD
jacques.palayret@xxxxxxxx
Fixe : +33 561078319


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux