Search code examples
geolocationgeospatialoracle-spatial

Geo Fence: how to indentify an object(feature), overlapping a geofence boundary using Oracle Spatial?


I have a polygon (a geo fence), in a database table State and a Table Universities to hold university information. Now I would like to find if the University is inside our outside a polygon; if it falls on the boundary of the polygon.

I thought one way could be to calculate a mid point of the feature, and if the mid point lies within the polygon then the feature (University) inside the polygon; else if the point lies ouside/border of the polygon its outside of the polygon.

How do i achieve this using an Oracle Spatial Query?

Thanks.


Solution

  • What you want to look into is SDO_RELATE.

    You don't need to calculate the mid-point of the feature, just use the SDO_RELATE function. It will determine how they relate to each other, inside, outside, on, etc.

    Look at: http://download.oracle.com/docs/html/A85337_01/sdo_oper.htm for more information.