@DescribeProcess( title = "Length", description = "Returns the total length of all line segments in a geometry. Measurement is given in the source units, so geographic coordinates are not recommended." ) @DescribeResult(description = "Total perimeter of the geometry") public static double length( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.getLength(); }
@DescribeProcess( title = "Simple Test", description = "Tests if a geometry is topologically simple. Points, polygons, closed line strings, and linear rings are always simple. Other geometries are considered simple if no two points are identical." ) @DescribeResult(description = "True if the input is simple") public static boolean isSimple( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.isSimple(); }
@DescribeProcess( title = "Boundary", description = "Returns a geometry boundary. For polygons, returns a linear ring or multi-linestring equal to the boundary of the polygon(s). For linestrings, returns a multipoint equal to the endpoints of the linestring. For points, returns an empty geometry collection." ) @DescribeResult(description = "Boundary of the input geometry") public static Geometry boundary( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.getBoundary(); }
@DescribeProcess( title = "Exterior Ring", description = "Returns the exterior ring of a polygonal geometry." ) @DescribeResult(description = "Exterior ring of geometry") public static Geometry exteriorRing( @DescribeParameter(name = "geom", description = "Input geometry") Polygon polygon) { return polygon.getExteriorRing(); }
@DescribeProcess( title = "Area", description = "Returns the area of a geometry, in the units of the geometry. Assumes a Cartesian plane, so this process is only recommended for non-geographic CRSes." ) @DescribeResult(description = "Area of the input geometry") public static double area( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.getArea(); }
@DescribeProcess( title = "Centroid", description = "Returns the geometric centroid of a geometry. Output is a single point. The centroid point may be located outside the geometry." ) @DescribeResult(description = "Centroid of the input geometry") public static Geometry centroid( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.getCentroid(); }
@DescribeProcess( title = "Closed Test", description = "Tests if the initial vertex equals the final vertex in a linear geometry. Points and polygons always return True." ) @DescribeResult(description = "True if the input is closed") public static boolean isClosed( @DescribeParameter(name = "geom", description = "Input geometry") LineString line) { return line.isClosed(); }
@DescribeProcess( title = "End Point", description = "Returns a point geometry equal to the final vertex of a LineString." ) @DescribeResult(description = "Final vertex as point geometry") public static Point endPoint( @DescribeParameter(name = "geom", description = "Input line") LineString line) { return line.getEndPoint(); }
@DescribeProcess( title = "Interior Ring Count", description = "Returns the total number of interior rings in a polygonal geometry. Points and lines return 0." ) @DescribeResult(description = "Total number of interior rings") public static int numInteriorRing( @DescribeParameter(name = "geom", description = "Input geometry") Polygon polygon) { return polygon.getNumInteriorRing(); }
@DescribeProcess( title = "Number of Points", description = "Returns the number of vertices in a given geometry." ) @DescribeResult(description = "Total number of vertices") public static int numPoints( @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) { return geom.getNumPoints(); }
@DescribeProcess( title = "Get Y Ordinate", description = "Returns the Y value (second ordinate) for point geometries. For other geometry types returns the Y value of the centroid." ) @DescribeResult(description = "Y value of point") public static double getY( @DescribeParameter(name = "geom", description = "Input point") Point point) { return point.getY(); }
@DescribeProcess( title = "Distance", description = "Returns the minimum distance between two geometries. Measurement is given in the input units, so geographic coordinates are not recommended." ) @DescribeResult(description = "Distance between the two input geometries") public static double distance( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.distance(b); }
@DescribeProcess( title = "Disjoint Test", description = "Tests if two geometries do not have any points in common." ) @DescribeResult(description = "True if the inputs are disjoint") public static boolean disjoint( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.disjoint(b); }
@DescribeProcess( title = "Overlaps Test", description = "Tests if two geometries share some but not all interior points. Points or lines will always return False." ) @DescribeResult(description = "True if the inputs overlap") public static boolean overlaps( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.overlaps(b); }
@DescribeProcess( title = "Intersection", description = "Returns a geometry representing the points that two geometries have in common. The result may be a heterogeneous geometry collection. If no intersection, returns an empty geometry." ) @DescribeResult(description = "Intersection of geometries") public static Geometry intersection( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.intersection(b); }
@DescribeProcess( title = "Difference", description = "Returns a geometry representing the points that are contained in a geometry but not contained in a second geometry. The result may be a heterogeneous geometry collection." ) @DescribeResult(description = "Geometry representing the difference of the input geometries") public static Geometry difference( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.difference(b); }
@DescribeProcess( title = "Crosses Test", description = "Tests if two geometries have some, but not all, interior points in common." ) @DescribeResult(description = "True if the inputs cross") public static boolean crosses( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.crosses(b); }
@DescribeProcess( title = "Within Test", description = "Tests if the first geometry is contained in the second geometry." ) @DescribeResult(description = "True if the first input is within the second input") public static boolean within( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.within(b); }
@DescribeProcess( title = "Symmetric Difference", description = "Returns a geometry representing the points contained in either one of two geometries but not in both. The result may be a heterogeneous geometry collection." ) @DescribeResult(description = "Symmetric difference of the two geometries") public static Geometry symDifference( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.symDifference(b); }
@DescribeProcess( title = "Relate Matrix String", description = "Returns the DE-9IM intersection matrix string for the spatial relationship between the input geometries. The matrix string is in the form [II][IB][IE][BI][BB][BE][EI][EB][EE] where I=interior, B=boundary, and E=exterior. Matrix symbols are 2, 1, 0 or F." ) @DescribeResult(description = "Intersection matrix string") public static String relate( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) { return a.relate(b).toString(); }