Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# Inside
[Spatial Relationships]

## OGC Definition

There is none.

## Oracle Spatial Definition

[OSUGR] defines Inside as follows. "The opposite of CONTAINS. A INSIDE B implies B CONTAINS A. See Contains . The FDO Oracle Provider implements Inside using the inside spatial operator.

inside = inside as used in the third argument to the sdo_relate spatial operator, for example,
`sdo_relate(a.GEOMETRY, MDSYS.SDO_GEOMETRY(2002, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1), MDSYS.SDO_ORDINATE_ARRAY(1,1, 6,1)), 'mask=inside')`

## PHP Code Implementation

The equivalent of the Inside predicate can be expressed using MgGeometry methods as follows.

    <?php
    function Inside ($geom1, $geom2) {
       $withinBool = $geom1->Within($geom2);
       if (!$withinBool) return $withinBool;
       $boundary1 = $geom1->Boundary();
       $boundary2 = $geom2->Boundary();
       $intersectBool = $boundary1->Intersects($boundary2);
       return !$intersectBool;
    }
    ?>

## Illustration

The concentric circles represent intersecting points. a, e, g, h, and j are MultiPoint geometries.

Comments or suggestions? Send us feedback.