# Geometry Functions

Geometry Functions is a very complete tool for geometry processing. How it works depends on the geometry function you choose and on the following options :

Use Selected Features Only - If checked, only selected features of the source layer will be processed. If not checked, each feature of the source layer will be processed.

Create new layer for result - With this default option, result will be output in a new layer.

Update Source features with the result - This option is useful to update a layer. Processed feature geometries will be replace source ones.

Add Result to source layer - May be useful to add new features to a layer while keeping original ones.

• Geometry functions using a layer and a mask - A mask is a layer containing a single geometry. The following functions will compare each geometry of the source layer to the mask. Note that the single geometry contained in the mask may be a MultiGeometry but not a GeometryCollection. The result contains as many features as the source layer.
• Intersections - Creates features which are the intersection of source feature geometries with the mask.
• Union - Creates features which are the union of each single feature of source layer with the feature geometry of mask.
• Difference (A-B) - Substract geometry of the mask to each feature of the source layer. You can for example clean a layer by removing parts of feature geometries overlapping the ocean surface..
• Difference (B-A) - You may want to do the opposite : remove feature geometries from ocean area.
• Symmetric difference - Symmetric difference will keep the part of source geometries which does not intersect the mask with the part of the mask which does not intersects the source geometry.
• Geometry functions using a single layer
• Centroid of A - Computes the centroid of each feature geometry. The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).
• Interior Point - Computes an interior for each feature Geometry. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.
• Buffer - Computes a buffer for each geometry. Just take a distance paramater. If you need more options, use Analysis > Buffer... tool.
• Simplify (D-P) - Simplify each geometry using the Douglas-Peucker algorithm. Ensures that any polygonal geometries returned are valid. Simple lines are not guaranteed to remain simple after simplification. Note that in general D-P does not preserve topology - e.g. polygons can be split, collapse to lines or disappear holes can be created or disappear, and lines can cross. To simplify geometry while preserving topology use TopologyPreservingSimplifier. (However, using D-P is significantly faster).
• Simplify (Preserve Topology) - Simplifies each geometry, ensuring that the result is a valid geometry having the same dimension and number of components as the input. The simplification uses a maximum distance difference algorithm similar to the one used in the Douglas-Peucker algorithm.
• Densify - [New in OpenJUMP 1.6] Densify a geometry by adding a pont every xxx units.
• Concex Hull - Returns convex hull of each geometry. Convex hull dimension depends on the input geometry. Convex hull of a point is a point, convex hull of a straight line or a multipoint made of two points is a linestring, convex hull of a complex (multi)linestring or a (multi)polygon is a polygon.
• Boundary - Returns the boundary, or an empty geometry of appropriate dimension if the geometries are empty. (In the case of zero-dimensional geometries, ' an empty GeometryCollection is returned.) For a discussion of this function, see the OpenGIS Simple Features Specification. As stated in SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of the next lower dimension."
• Envelope - Returns rectangular envelope of each geometry. Envelope can be a point (for point geometry) or a linestring (ex. horizontal linestring).
• Reverse Line Direction - Reverse the orientation of each linear element. Polygon boundaries are also reversed. Warning : lines are reversed on the new layer AND on the source layer, which must be considered as a bug.
• Geometry functions usually working on a set of geometries) - Following functions are also applied to each geometry of the source layer. To make them useful, you'll probably have to combine input features into a single multi-geometry first, then explode the result.
• Line Merge - Merge contiguous lines of a multilinestring. Linestring are not merged if the order of their common node is 3 or more (A-B and B-C are merged, but A-B, B-C and B-D are not merged).
• Line Sequence - Lines of the multilinestring are not merged, but they are oriented so that the end of a line equals the start of the following one, while preserving the original orientation as much as possible. For a complete description, see the javadoc.
• Polygonize - Build polygons from a set of noded linestrings. Noded means that there should be a node at each intersection, not only a vertex. To achieve that, you may have to compute intersections first. Note that there is a more complete Polygonizer in the Edit Geometry menu.