0

I have two varchar columns with wkt value (a polygon and a point). I want to know if there are a polygon that contains some point using Oracle.

I'm using sdo_contains command, but don't work. According the documentation, the polygon should be indexed. Can anyone help me how to get around this problem? I don't want to create a geometry column. I can't change the table structure or add a column.

Felipe
  • 49
  • 1
  • 8

1 Answers1

0

SDO_CONTAINS is a spatial operator function and does indeed require an index (or rather, an indexed geometry column).

For arbitrary in-memory geometry objects, you can use SDO_GEOM.RELATE with the CONTAINS or INSIDE mask.

https://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objgeom.htm#BGHCDIDG

Ben
  • 1,902
  • 17
  • 17
  • Thanks @Ben. To future reference: `sdo_geom.relate(sdo_geom.sdo_geometry(a.wkt_polygon, 4326), 'contains', sdo_geom.sdo_geometry('POINT(' || b.longitude || ' ' || b.latitude || ')', 4326), 0.005)` – Felipe Feb 10 '16 at 17:20