[postgis-users] st_within maddness

Kevin Galligan kg at kagii.com
Fri Jul 24 07:57:37 PDT 2009


I tried with a different SRID anyway, just to remove that from the mix...

create table rresp.testwithin4326(id int);
SELECT AddGeometryColumn ('rresp','testwithin4326','bbox',4326,'POLYGON',2);
insert into rresp.testwithin4326(id, bbox) values(1,
ST_SetSRID(ST_MakeBox2D(ST_Point(-71.0600, 42.3600),ST_Point(-71.0000,
42.4200)),4326));

select asewkt(ST_Buffer(ST_SetSRID(ST_MakePoint(-71.0600, 42.3600),4326), .5));

--Just to make sure we have a row (we do)
select asewkt(bbox) from rresp.testwithin4326;

--Select from the circle (it returns nothing)
select asewkt(bbox) from rresp.testwithin4326 where st_within(bbox,
ST_Buffer(ST_SetSRID(ST_MakePoint(-71.0600, 42.3600),4326), .5));

--Select with a bigger box (returns the row)
select asewkt(bbox) from rresp.testwithin4326 where st_within(bbox,
ST_SetSRID(ST_MakeBox2D(ST_Point(-71.1600, 42.2600),ST_Point(-70.0900,
42.5200)),4326));

On Fri, Jul 24, 2009 at 10:47 AM, Maxime van Noppen<maxime at altribe.org> wrote:
> On 07/24/09 16:46, Kevin Galligan wrote:
>> Might I ask where you get the definition of srid '900913'?  I know I
>> had to insert that myself from something I found on the web.  I'm
>> shooting in the dark here, but that's another possible variable in the
>> mix.
>
> I didn't check the SRID value but PostGIS said nothing about it :
>
>> tmp=# create table testwithin(id int);
>> CREATE TABLE
>> tmp=# SELECT AddGeometryColumn('testwithin','bbox',900913,'POLYGON',2);
>>                    addgeometrycolumn
>> --------------------------------------------------------
>>  public.testwithin.bbox SRID:900913 TYPE:POLYGON DIMS:2
>>
>> (1 row)
>>
>> tmp=# insert into testwithin(id, bbox) values(1, ST_SetSRID(ST_MakeBox2D(ST_Point(-8232000, 4980000),ST_Point(-8231900,
>> 4980100)),900913));
>> INSERT 0 1
>> tmp=# select asewkt(bbox) from testwithin where st_within(bbox, ST_Buffer(ST_SetSRID(ST_MakePoint(-8232000, 4980000),900913), 500));
>>                                                    asewkt
>> -------------------------------------------------------------------------------------------------------------
>>  SRID=900913;POLYGON((-8232000 4980000,-8232000 4980100,-8231900 4980100,-8231900 4980000,-8232000 4980000))
>> (1 row)
>
> AFAIK it's a vanilla PostGIS-1.3.6.
>
> --
> yabo
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
--------------------
Kevin Galligan
www.kagii.com



More information about the postgis-users mailing list