[postgis-users] oddity with computing areas
Mike Toews
mwtoews at gmail.com
Tue Jul 17 14:46:00 PDT 2012
Hi Eric,
Are your geometries valid? See the following example to illustrate my point:
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;
-Mike
On 18 July 2012 09:12, Eric McKeeth <eldin00 at gmail.com> wrote:
> Hello. I'm seeing behavior I don't understand when computing the area
> of the intersection of two geometries. Given the columns geom_a and
> geom_b, both MULTIPOLYGON geometries with the same SRID (4269 in this
> case), I'm selecting st_area(st_intersection(geom_a, geom_b)). In most
> cases, I'm getting results that look correct. But in a small
> percentage of cases, I'm getting cases where the area is much larger
> than expected (i.e. as much as 30x greater than the larger of
> st_area(geom_a) and st_area(geom_b)). It seems to me that it should
> always hold that the area of the smaller of two geometries should be
> the upper bound for the area of their intersection. I'm only seeing
> the issue in cases where the two geometries intersect, but neither
> contains the other. Does anyone have any ideas as to what could cause
> this?
>
> Thank you in advance for any help,
> -Eric
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list