[postgis-users] oddity with computing areas

Mike Toews mwtoews at gmail.com
Tue Jul 17 14:48:55 PDT 2012


On 18 July 2012 09:46, Mike Toews <mwtoews at gmail.com> wrote:
> with data as (select 'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::geometry AS geom1,
> 'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, 0 0))'::geometry AS geom2)
> select st_isvalid(geom1), st_area(geom1),
>        st_isvalid(geom2), st_area(geom2)
> from data;

Hmm, on further analysis, valid geometries shouldn't matter as much
for ST_Intersection:

with data as (select 'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::geometry AS geom1,
'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, 0 0))'::geometry AS geom2)
select
 st_isvalid(st_intersection(geom1, geom1)),
 st_area(st_intersection(geom1, geom1))
from data;

-MIke



More information about the postgis-users mailing list