Hello, I face what I think is a precision problem. I have a point and a polygon and I test whether the point is within the polygon or not. When both geometries are in WKB, ST_Within returns false whereas when they are in WKT it returns true.
WKB : -------------------------------------------------------------------------- # SELECT ST_Within('010100000013898E0BA7E833C1FF843EA52C212C41', ' 0103000000010000000400000000000000A09134C10000000088212A4100000000A0E832C10000000000812A41000000005E0634C1CDCCCCCC79512C4100000000A09134C10000000088212A41'); st_within ----------- f (1 row) -------------------------------------------------------------------------- WKT : -------------------------------------------------------------------------- # SELECT ST_Within('POINT(-1304743.04514367 921750.322742611)', 'POLYGON((-1348000 856260,-1239200 868480,-1312350 927932.9,-1348000 856260))'); st_within ----------- t (1 row) -------------------------------------------------------------------------- The point is on the border of the polygon and I found that using DWithin with 0 as tolerance makes both test work : WKB : -------------------------------------------------------------------------- # SELECT ST_DWithin('010100000013898E0BA7E833C1FF843EA52C212C41', '0103000000010000000400000000000000A09134C10000000088212A4100000000A0E832C10000000000812A41000000005E0634C1CDCCCCCC79512C4100000000A09134C10000000088212A41', 0); st_dwithin ------------ t (1 row) -------------------------------------------------------------------------- For now I'll use this solution but I find it quite hacky. Is this a normal precision-related behaviour ? Thanks, -- yabo _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users