Home » Server Options » Spatial » sdo_contains help (oracle 11g)
sdo_contains help [message #570124] Mon, 05 November 2012 15:06 Go to next message
gentleman777us
Messages: 122
Registered: April 2005
Senior Member
Objective: given latitude and longitude I need to get the county name and county state from the US_COUNTIES tables which has geometry column of the polygon.

I have the following query:

select county, state
from us_counties usc
where sdo_contains(usc.geom, sdo_geometry(2001,8307,sdo_point_type(-159.7278747,22.0824105,null),null,null)) = 'TRUE';

I get no records

Is there anything wrong with my query.

the geom colum in US_COUNTIES table has spatial index.

Am I missing anything,

Any help is greatly appreciated.

Thanks
Re: sdo_contains help [message #570297 is a reply to message #570124] Wed, 07 November 2012 12:43 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9100
Registered: November 2002
Location: California, USA
Senior Member
You might try experimenting with sdo_relate and 'mask=contains'. You might also try using sdo_geom.relate with 'determine' to see what relationship it shows. If this doesn't help, then please provide a reproducible test case.
Re: sdo_contains help [message #570551 is a reply to message #570124] Mon, 12 November 2012 03:42 Go to previous message
_jum
Messages: 577
Registered: February 2008
Senior Member
You could use the RELATE function from the SDO_GEOM package before/instead of the spatial OPERATOR SDO_CONTINS.
The function doesn't need a spatial index and you get an idea how the geometries interact with the point:
SELECT county, state,
       SDO_GEOM.relate (usc.geom, 'DETERMINE', sdo_geometry (2001,8307,sdo_point_type (-159.7278747, 22.0824105, NULL),NULL,NULL), 0.001) rela
  FROM us_counties usc;

Excuse - I just see, that's what Barbara suggested.

[Updated on: Mon, 12 November 2012 03:43]

Report message to a moderator

Previous Topic: create SDO_ORDINATE_ARRAY from number array
Next Topic: Performance Issue with the query
Goto Forum:
  


Current Time: Thu Nov 21 07:04:20 CST 2024