locatePointInGeom static method

int locatePointInGeom(
  1. Coordinate p,
  2. Geometry geom
)

Determines the {@link Location} of a point in an areal {@link Geometry}. The return value is one of:

  • {@link Location.INTERIOR} if the point is in the geometry interior
  • {@link Location.BOUNDARY} if the point lies exactly on the boundary
  • {@link Location.EXTERIOR} if the point is outside the geometry

@param p the point to test @param geom the areal geometry to test @return the Location of the point in the geometry

Implementation

static int locatePointInGeom(Coordinate p, Geometry geom) {
  if (geom.isEmpty()) return Location.EXTERIOR;
  /**
   * Do a fast check against the geometry envelope first
   */
  if (!geom.getEnvelopeInternal().intersectsCoordinate(p))
    return Location.EXTERIOR;

  return locateInGeometry(p, geom);
}