[postgis-users] st_within maddness

Kevin Galligan kg at kagii.com
Fri Jul 24 07:06:27 PDT 2009


A little more follow up to my post.

I got the polygon definition for the "circle", and cut out all of the
intermediate points, leaving just a diamond shape...

SRID=900913;POLYGON((
-8231500 4980000,
-8232000 4979500,
-8232500 4980000,
-8232000 4980500,
-8231500 4980000))

Also, being paranoid, just to make sure we're not clipping against the
side of the interior box, I added another one that's just 5 meters on
either side...

insert into rresp.testwithin(id, bbox) values(1,
ST_SetSRID(ST_MakeBox2D(ST_Point(-8232000, 4980000),ST_Point(-8231995,
4980005)),900913));

When I run the query with the diamond...

select asewkt(bbox) from rresp.testwithin where st_within(bbox,
geomfromewkt('SRID=900913;POLYGON((
-8231500 4980000,
-8232000 4979500,
-8232500 4980000,
-8232000 4980500,
-8231500 4980000))'));

No results.  However, I manually created the definition of a box that
has the outer corner points of the diamond and ran the query...

select asewkt(bbox) from rresp.testwithin where st_within(bbox,
geomfromewkt('SRID=900913;POLYGON((
-8231500 4980500,
-8231500 4979500,
-8232500 4979500,
-8232500 4980500,
-8231500 4980500))'));

That returns both interior boxes.

Still completely baffled.  Any input would be greatly appreciated.

-Kevin



More information about the postgis-users mailing list