Class GeometryFactory

java.lang.Object
com.luciad.geometries.GeometryFactory

public final class GeometryFactory extends Object
Factory to create geometries defined within a coordinate reference.

You can read more about the available geometries here.

  • Method Details Link icon

    • createPoint Link icon

      @NotNull public static Point createPoint(@NotNull CoordinateReference reference, double x, double y, double z)
      Factory method to create a point.

      Example to create a point geometry:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Point point = GeometryFactory.createPoint(crs, 3.5, 51.4, 123.0);
      Parameters:
      reference - the coordinate reference in which the point is defined.
      x - the x-value of the point.
      y - the y-value of the point.
      z - the z-value of the point.
      Returns:
      the point.
    • createPoint Link icon

      @NotNull public static Point createPoint(@NotNull CoordinateReference reference, @NotNull Coordinate location)
      Factory method to create a point from a coordinate.

      Example to create a point geometry:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate location = new Coordinate(3.5, 51.4, 123.0);
      Point point = GeometryFactory.createPoint(crs, location);
      Parameters:
      reference - the coordinate reference in which the point is defined.
      location - the location of the point
      Returns:
      the point.
    • createBounds Link icon

      @NotNull public static Bounds createBounds(@NotNull CoordinateReference reference, @NotNull Coordinate location, double width, double height, double depth)
      Factory method to create a bounding box geometry.

      Example to create a bounds geometry:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate location = new Coordinate(3.5, 51.4, 123.0);
      double width = 5.5;
      double height = 6.6;
      double depth = 123.0;
      Geometry bounds = GeometryFactory.createBounds(crs, location, width, height, depth);
      Parameters:
      reference - the coordinate reference in which the point is defined.
      location - the lower left location of the bounds.
      width - the width of the bounds (positive value).
      height - the height of the bounds (positive value).
      depth - the depth of the bounds (positive value).
      Returns:
      the point.
    • createCircleByCenterPoint Link icon

      @NotNull public static CircleByCenterPoint createCircleByCenterPoint(@NotNull CoordinateReference reference, @NotNull Coordinate center, double radius) throws IllegalArgumentException
      Factory method to create a circle.

      Example usage:

      String identifier = "EPSG:3857";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double radius = 12000.0;
      Geometry circle = GeometryFactory.createCircleByCenterPoint(crs, center, radius);

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circle are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      Parameters:
      reference - the coordinate reference in which the circle is defined.
      center - the center point of the circle.
      radius - the radius of the circle. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      Returns:
      the circle.
      Throws:
      IllegalArgumentException - if the radius is smaller than 0.
    • createCircleBy3Points Link icon

      @NotNull public static CircleBy3Points createCircleBy3Points(@NotNull CoordinateReference reference, @NotNull Coordinate startPoint, @NotNull Coordinate firstIntermediatePoint, @NotNull Coordinate secondIntermediatePoint) throws IllegalArgumentException
      Factory method to create a circle, given three points.

      The points are allowed to have a Z-value, but all Z-values are required to be equal. If this requirement is not met, an exception is thrown.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate startPoint = new Coordinate(3.5, 51.4, 123.0);
      Coordinate firstIntermediatePoint = new Coordinate(10, 50, 123.0);
      Coordinate secondIntermediatePoint = new Coordinate(8, 54, 123.0);
      CircleBy3Points circleBy3Points = GeometryFactory.createCircleBy3Points(crs, startPoint, firstIntermediatePoint, secondIntermediatePoint);

      A circle by-3-points where the three points coincide represents a circle with these points as its center and a radius of 0.

      A circle by-3-points where 2 out of 3 points coincide represents a circle with its center located in the middle between the 2 coinciding points and the other point.

      A circle by-3-points where the 3 points are co-linear results in java.lang.IllegalArgumentException exceptions when curve methods are called in case the coordinate reference is Cartesian .

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circle are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circle is defined.
      startPoint - the start point of the circle.
      firstIntermediatePoint - the first intermediate point of the circle.
      secondIntermediatePoint - the second intermediate point of the circle.
      Returns:
      the circle.
      Throws:
      IllegalArgumentException - if the input points do not have equal Z-values.
    • createCircularArcBy3Points Link icon

      @NotNull public static CircularArcBy3Points createCircularArcBy3Points(@NotNull CoordinateReference reference, @NotNull Coordinate startPoint, @NotNull Coordinate intermediatePoint, @NotNull Coordinate endPoint) throws IllegalArgumentException
      Factory method to create a circular arc, given three points.

      The circular arc will start at the given start point, pass through the given intermediate point and end in the given end point. The points are allowed to have a Z-value, but all Z-values are required to be equal. If this requirement is not met, an exception is thrown.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate startPoint = new Coordinate(3.5, 51.4, 123.0);
      Coordinate intermediatePoint = new Coordinate(10, 50, 123.0);
      Coordinate endPoint = new Coordinate(8, 54, 123.0);
      CircularArcBy3Points arc = GeometryFactory.createCircularArcBy3Points(crs, startPoint, intermediatePoint, endPoint);

      A circular arc-by-3-points where the start, end and intermediate point coincide represents an arc on a circle with these points as its center and a radius of 0.

      A circular arc-by-3-points where 2 out of 3 points coincide represents an arc on a circle with its center located in the middle between the 2 coinciding points and the other point. If the start and end point coincide, a full circle is drawn, otherwise, the arc is interpreted as half a circle in counterclockwise direction from start to end point.

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      startPoint - the start point of the circular arc.
      intermediatePoint - an intermediate point of the circular arc.
      endPoint - the end point of the circular arc.
      Returns:
      the circular arc.
      Throws:
      IllegalArgumentException - if the input points do not have equal Z-values.
    • createCircularArcByBulge Link icon

      @NotNull public static CircularArcByBulge createCircularArcByBulge(@NotNull CoordinateReference reference, @NotNull Coordinate startPoint, @NotNull Coordinate endPoint, double bulge) throws IllegalArgumentException
      Factory method to create a circular arc, starting at the given start point and ending in the given end point.

      The points are allowed to have a Z-value, but both Z-values are required to be equal. If this requirement is not met, an exception is thrown.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate startPoint = new Coordinate(3.5, 51.4, 123.0);
      Coordinate endPoint = new Coordinate(8, 54, 123.0);
      double bulge = -0.7;
      CircularArcByBulge arc = GeometryFactory.createCircularArcByBulge(crs, startPoint, endPoint, bulge);

      The bulge factor is the ratio of (1) the distance between the arc midpoint and the center of the arc's chord, and (2) half the length of the arc's chord. The sign of the bulge indicates whether the midpoint is on the left side (positive) or right side (negative) of the vector from start to end point. So a bulge factor with an absolute value of 1 means a half-circle, smaller than 1 means a less bulging arc and larger than 1 means an arc that bulges out in the start and end point.

      A circular arc-by-bulge where the start and end point coincide represents an arc on a circle with these points as its center and a radius of 0. The bulge factor is ignored in this case.

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      startPoint - the start point of the circular arc.
      endPoint - the end point of the circular arc.
      bulge - the bulge factor of the circular arc.
      Returns:
      the circular arc.
      Throws:
      IllegalArgumentException - if the input points do not have equal Z-values.
    • createCircularArcByCenterPoint Link icon

      @NotNull public static CircularArcByCenterPoint createCircularArcByCenterPoint(@NotNull CoordinateReference reference, @NotNull Coordinate center, double radius, @NotNull Angle startAngle, @NotNull Angle endAngle, @NotNull Angle.Direction angleDirection)
      Factory method to create a circular arc.

      Create the circular arc you need Link icon

      The angles for the circular arc are expressed in degrees counterclockwise from the direction at 3 o'clock. The arc segment goes from the start angle to the end angle in the positive direction (counterclockwise).

      To create a circular arc with an extent from 45° to 300° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double radius = 12000.0;
      Angle startAngle = new Angle(45.0);
      Angle endAngle = new Angle(300.0);
      CircularArcByCenterPoint arc = GeometryFactory.createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);

      Arc from 45° to 300°
      Arc from 45° to 300°

      To create a circular arc with an extent from 300° to 45° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double radius = 12000.0;
      Angle startAngle = new Angle(300.0);
      Angle endAngle = new Angle(45.0);
      CircularArcByCenterPoint arc = GeometryFactory.createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);

      Arc from 300° to 45°
      Arc from 300° to 45°

      Creation of a circular arc with the start and the end angle having the same value results in full circle.

      Optional orientation of the arc Link icon

      The default orientation for the circular arc is counterclockwise. The circular arc is a curve that is useful as a sub-curve building block for other geometries, e.g., an arc band. Therefore it also supports the specification of the orientation of the arc. When the orientation value is set to clock-wise the arc segment goes from the start angle to the end angle in counter clock wise direction (negative direction).

      Interpretation based on the coordinate reference Link icon

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      center - the center point of the circular arc.
      radius - the radius of the circular arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      startAngle - the start angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
      endAngle - the end angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
      angleDirection - optional parameter defining the orientation of the arc. The default value is counter clock-wise.
      Returns:
      the circular arc.
    • createCircularArcByCenterPoint Link icon

      @NotNull public static CircularArcByCenterPoint createCircularArcByCenterPoint(@NotNull CoordinateReference reference, @NotNull Coordinate center, double radius, @NotNull Angle startAngle, @NotNull Angle endAngle)
      Factory method to create a circular arc.

      Create the circular arc you need Link icon

      The angles for the circular arc are expressed in degrees counterclockwise from the direction at 3 o'clock. The arc segment goes from the start angle to the end angle in the positive direction (counterclockwise).

      To create a circular arc with an extent from 45° to 300° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double radius = 12000.0;
      Angle startAngle = new Angle(45.0);
      Angle endAngle = new Angle(300.0);
      CircularArcByCenterPoint arc = GeometryFactory.createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);

      Arc from 45° to 300°
      Arc from 45° to 300°

      To create a circular arc with an extent from 300° to 45° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double radius = 12000.0;
      Angle startAngle = new Angle(300.0);
      Angle endAngle = new Angle(45.0);
      CircularArcByCenterPoint arc = GeometryFactory.createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);

      Arc from 300° to 45°
      Arc from 300° to 45°

      Creation of a circular arc with the start and the end angle having the same value results in full circle.

      Optional orientation of the arc Link icon

      The default orientation for the circular arc is counterclockwise. The circular arc is a curve that is useful as a sub-curve building block for other geometries, e.g., an arc band. Therefore it also supports the specification of the orientation of the arc. When the orientation value is set to clock-wise the arc segment goes from the start angle to the end angle in counter clock wise direction (negative direction).

      Interpretation based on the coordinate reference Link icon

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      center - the center point of the circular arc.
      radius - the radius of the circular arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      startAngle - the start angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
      endAngle - the end angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
      Returns:
      the circular arc.
    • createEllipse Link icon

      @NotNull public static Ellipse createEllipse(@NotNull CoordinateReference reference, @NotNull Coordinate center, double a, double b, @NotNull Angle rotationAngle) throws IllegalArgumentException
      Factory method to create an ellipse.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate centerPoint = new Coordinate(3.5, 51.4, 123.0);
      double a = 12000;
      double b = 6000;
      Angle rotAngle = new Angle(45);
      Ellipse ellipse = GeometryFactory.createEllipse(crs, centerPoint, a, b, rotAngle);

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the ellipse are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the ellipse is defined.
      center - the center point of the ellipse.
      a - the length of the semi-major axis of the ellipse. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      b - the length of the semi-minor axis of the ellipse. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      rotationAngle - the rotation angle of the ellipse.
      Returns:
      the ellipse.
      Throws:
      IllegalArgumentException - if a or b is smaller than 0.
    • createEllipticalArc Link icon

      @NotNull public static EllipticalArc createEllipticalArc(@NotNull CoordinateReference reference, @NotNull Coordinate center, double a, double b, @NotNull Angle startAngle, @NotNull Angle endAngle, @NotNull Angle rotationAngle, @NotNull Angle.Direction angleDirection) throws IllegalArgumentException
      Factory method to create an elliptical arc.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate centerPoint = new Coordinate(3.5, 51.4, 123.0);
      double a = 12000;
      double b = 6000;
      Angle startAngle = new Angle(30);
      Angle endAngle = new Angle(125);
      Angle rotAngle = new Angle(45);
      EllipticalArc arc = GeometryFactory.createEllipticalArc(crs, centerPoint, a, b, startAngle, endAngle, rotAngle);

      Creation of an elliptical arc with the start and the end angle having the same value results in full ellipse.

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the elliptical arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the elliptical arc is defined.
      center - the center point of the elliptical arc.
      a - the length of the semi-major axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      b - the length of the semi-minor axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      startAngle - the start angle of the elliptical arc.
      endAngle - the end angle of the elliptical arc.
      rotationAngle - the rotation of the ellipse on which the arc is defined
      angleDirection - optional parameter defining the orientation of the arc, i.e. in which direction the arc extends from the start angle to the end angle. The default value is counterclockwise.
      Returns:
      the elliptical arc.
      Throws:
      IllegalArgumentException - if a or b is smaller than 0.
    • createEllipticalArc Link icon

      @NotNull public static EllipticalArc createEllipticalArc(@NotNull CoordinateReference reference, @NotNull Coordinate center, double a, double b, @NotNull Angle startAngle, @NotNull Angle endAngle, @NotNull Angle rotationAngle) throws IllegalArgumentException
      Factory method to create an elliptical arc.

      Example usage:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate centerPoint = new Coordinate(3.5, 51.4, 123.0);
      double a = 12000;
      double b = 6000;
      Angle startAngle = new Angle(30);
      Angle endAngle = new Angle(125);
      Angle rotAngle = new Angle(45);
      EllipticalArc arc = GeometryFactory.createEllipticalArc(crs, centerPoint, a, b, startAngle, endAngle, rotAngle);

      Creation of an elliptical arc with the start and the end angle having the same value results in full ellipse.

      When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the elliptical arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the elliptical arc is defined.
      center - the center point of the elliptical arc.
      a - the length of the semi-major axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      b - the length of the semi-minor axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      startAngle - the start angle of the elliptical arc.
      endAngle - the end angle of the elliptical arc.
      rotationAngle - the rotation of the ellipse on which the arc is defined
      Returns:
      the elliptical arc.
      Throws:
      IllegalArgumentException - if a or b is smaller than 0.
    • createPolyline Link icon

      @NotNull public static Polyline createPolyline(@NotNull CoordinateReference reference, @NotNull List<@NotNull Coordinate> points, @NotNull LineInterpolationType curveInterpolationType) throws IllegalArgumentException
      Factory to create a polyline.

      Polyline objects can be created with the interpolation types:

      • linear
      • geodesic
      • rhumb

      The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

      Creation of geodesic polyline:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Polyline polyline = GeometryFactory.createPolyline(crs, Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 256.0),
      new Coordinate(15.0, 40.0, 321.0),
      new Coordinate(-10.0, 50.0, 123.0)
      ), LineInterpolationType.Geodesic);

      Creation of rhumb polyline:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Polyline polyline = GeometryFactory.createPolyline(crs, Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 256.0),
      new Coordinate(15.0, 40.0, 321.0),
      new Coordinate(-10.0, 50.0, 123.0)
      ), LineInterpolationType.Rhumb);

      Creation of linear polyline in a cartesian coordinate reference:

      String identifier = "EPSG:3857";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Polyline polyline = GeometryFactory.createPolyline(crs, Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 256.0),
      new Coordinate(15.0, 40.0, 321.0),
      new Coordinate(-10.0, 50.0, 123.0)
      ), LineInterpolationType.Linear);
      Parameters:
      reference - the coordinate reference in which the polyline is defined.
      points - the points defining the polyline.
      curveInterpolationType - the type of interpolation between the points, i.e., linear, geodesic, or rhumb.
      Returns:
      the polyline
      Throws:
      IllegalArgumentException - if the polyline cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.
    • createLine Link icon

      @NotNull public static Line createLine(@NotNull CoordinateReference reference, @NotNull Coordinate firstPoint, @NotNull Coordinate secondPoint, @NotNull LineInterpolationType curveInterpolationType) throws IllegalArgumentException
      Factory method to create a line.

      Line objects can be created with the interpolation types:

      • linear
      • geodesic
      • rhumb

      The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

      Creation of geodesic line:

      Coordinate startPoint = new Coordinate(-10.0, 50.0, 123.0);
      Coordinate endPoint = new Coordinate(15.0, 50.0, 256.0);
      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Line line = GeometryFactory.createLine(crs, startPoint, endPoint, LineInterpolationType.Geodesic);

      Creation of rhumb line:

      Coordinate startPoint = new Coordinate(-10.0, 50.0, 123.0);
      Coordinate endPoint = new Coordinate(15.0, 50.0, 256.0);
      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Line line = GeometryFactory.createLine(crs, startPoint, endPoint, LineInterpolationType.Rhumb);

      Creation of linear line in a cartesian coordinate reference:

      Coordinate startPoint = new Coordinate(-10.0, 50.0, 123.0);
      Coordinate endPoint = new Coordinate(15.0, 50.0, 256.0);
      String identifier = "EPSG:3857";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Line line = GeometryFactory.createLine(crs, startPoint, endPoint, LineInterpolationType.Linear);
      Parameters:
      reference - the coordinate reference in which the line is defined.
      firstPoint - first point of the line.
      secondPoint - second point of the line.
      curveInterpolationType - the type of interpolation between the points, i.e., linear, geodesic, or rhumb.
      Returns:
      the line geometry.
      Throws:
      IllegalArgumentException - if the line cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.
    • createPolylineRing Link icon

      @NotNull public static PolylineRing createPolylineRing(@NotNull CoordinateReference reference, @NotNull List<@NotNull Coordinate> points, @NotNull LineInterpolationType curveInterpolationType) throws IllegalArgumentException
      Factory to create a polyline to be used as ring.

      The polyline represents a closed curve. The implementation does not require the list of points to be such that the first and the last point are the same. A line segment is automatically included between the last point and the first point.

      Polyline objects can be created with the interpolation types:

      • linear
      • geodesic
      • rhumb

      The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

      Creation of a polyline as a ring:

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      PolylineRing polylineRing = GeometryFactory.createPolylineRing(crs, Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 256.0),
      new Coordinate(15.0, 40.0, 321.0)
      ), LineInterpolationType.Geodesic);
      Parameters:
      reference - the coordinate reference in which the polyline is defined.
      points - the points defining the polyline.
      curveInterpolationType - the type of interpolation between the points, i.e., linear, geodesic, or rhumb.
      Returns:
      the polyline, as a ring.
      Throws:
      IllegalArgumentException - if the polyline ring cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.
    • createPolygon Link icon

      @NotNull public static Polygon createPolygon(@NotNull PolylineRing exteriorRing, @NotNull List<@NotNull PolylineRing> interiorRings) throws IllegalArgumentException
      Factory to create a polygon.

      The polygon represents a surface whose boundary is defined by an exterior (polyline) ring and optionally a number of interior (polyline) rings.

      The following requirements must be met for the exterior ring and the interior rings:

      1. the coordinate references must be the same
      2. the interpolation type must be the same

      Creation of polygon that only has an exterior ring:

      List<Coordinate> points = Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 256.0),
      new Coordinate(15.0, 40.0, 321.0)
      );
      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      PolylineRing exteriorRing = GeometryFactory.createPolylineRing(crs, points, LineInterpolationType.Geodesic);
      List<PolylineRing> interiorRings = new ArrayList<>();
      Polygon polygon = GeometryFactory.createPolygon(exteriorRing, interiorRings);

      Creation of polygon that has a single hole:

      List<Coordinate> pointsExterior = Arrays.asList(
      new Coordinate(-10.0, 50.0, 123.0),
      new Coordinate(15.0, 50.0, 123.0),
      new Coordinate(15.0, 40.0, 123.0)
      );
      List<Coordinate> pointsInterior = Arrays.asList(
      new Coordinate(-0.0, 49.0, 123.0),
      new Coordinate(10.0, 49.0, 123.0),
      new Coordinate(10.0, 44.0, 123.0)
      );
      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      PolylineRing exteriorRing = GeometryFactory.createPolylineRing(crs, pointsExterior, LineInterpolationType.Geodesic);
      PolylineRing interiorRing = GeometryFactory.createPolylineRing(crs, pointsInterior, LineInterpolationType.Geodesic);
      List<PolylineRing> interiorRings = new ArrayList<>();
      interiorRings.add(interiorRing);
      Polygon polygon = GeometryFactory.createPolygon(exteriorRing, interiorRings);
      Parameters:
      exteriorRing - the exterior ring of the polygon.
      interiorRings - the interior rings of the polygon. This can be an empty list.
      Returns:
      the polygon.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createArcBand Link icon

      @NotNull public static ArcBand createArcBand(@NotNull CoordinateReference reference, @NotNull Coordinate center, double minRadius, double maxRadius, @NotNull Angle startAngle, @NotNull Angle endAngle, @NotNull Angle.Direction angleDirection) throws IllegalArgumentException
      Factory method to create an arc band.

      Create the arc band you need Link icon

      The angles for the arc band are expressed in degrees counterclockwise from the direction at 3 o'clock). By default, the arc band goes from the start angle to the end angle in the positive direction (counterclockwise). This can changed using the optional angleDirection parameter.

      To create an arc band from 30° to 145° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double minRadius = 12000.0;
      double maxRadius = 15000.0;
      Angle startAngle = new Angle(30.0);
      Angle endAngle = new Angle(145.0);
      Geometry arcBand = GeometryFactory.createArcBand(crs, center, minRadius, maxRadius, startAngle, endAngle);

      Creation of an arc band is very similar to a circular arc. See GeometryFactory#createCircularArcByCenterPoint.

      Interpretation based on the coordinate reference Link icon

      When the passed coordinate reference is a geodetic reference the distance calculations to determine points on the arc band are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      center - the center point of the arc band.
      minRadius - the minimal radius of the arc band.
      maxRadius - the maximal radius of the arc band.
      startAngle - the start angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
      endAngle - the end angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
      angleDirection - optional parameter defining the orientation of the arc, i.e. in which direction the arc extends from the start angle to the end angle. The default value is counterclockwise.
      Returns:
      the arc band.
      Throws:
      IllegalArgumentException - if the arc band cannot be created.
    • createArcBand Link icon

      @NotNull public static ArcBand createArcBand(@NotNull CoordinateReference reference, @NotNull Coordinate center, double minRadius, double maxRadius, @NotNull Angle startAngle, @NotNull Angle endAngle) throws IllegalArgumentException
      Factory method to create an arc band.

      Create the arc band you need Link icon

      The angles for the arc band are expressed in degrees counterclockwise from the direction at 3 o'clock). By default, the arc band goes from the start angle to the end angle in the positive direction (counterclockwise). This can changed using the optional angleDirection parameter.

      To create an arc band from 30° to 145° you can use the following code.

      String identifier = "EPSG:4326";
      CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
      Coordinate center = new Coordinate(3.5, 51.4, 123.0);
      double minRadius = 12000.0;
      double maxRadius = 15000.0;
      Angle startAngle = new Angle(30.0);
      Angle endAngle = new Angle(145.0);
      Geometry arcBand = GeometryFactory.createArcBand(crs, center, minRadius, maxRadius, startAngle, endAngle);

      Creation of an arc band is very similar to a circular arc. See GeometryFactory#createCircularArcByCenterPoint.

      Interpretation based on the coordinate reference Link icon

      When the passed coordinate reference is a geodetic reference the distance calculations to determine points on the arc band are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.

      For other coordinate references the distance calculations are done using cartesian calculations.

      Parameters:
      reference - the coordinate reference in which the circular arc is defined.
      center - the center point of the arc band.
      minRadius - the minimal radius of the arc band.
      maxRadius - the maximal radius of the arc band.
      startAngle - the start angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
      endAngle - the end angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
      Returns:
      the arc band.
      Throws:
      IllegalArgumentException - if the arc band cannot be created.
    • createExtrudedGeometry Link icon

      @NotNull public static ExtrudedGeometry createExtrudedGeometry(@NotNull CoordinateReference reference, @NotNull Geometry baseGeometry, double minHeight, double maxHeight) throws IllegalArgumentException
      Factory method to create an extruded geometry, based on a base geometry, minimum height and maximum height.

      If the base geometry has Z-values of its own, they are ignored. The maximum height cannot be smaller than the minimum height.

      If the given geometry is not a supported base for an extruded geometry, an exception is thrown. Use ExtrudedGeometry#isBaseGeometrySupported to check whether a geometry is supported or not. Currently, all Curve and Surface geometries are supported, as well as MultiGeometry instances that consist solely of such geometries.

      Example Usage:

      CoordinateReference crs = CoordinateReferenceProvider.create("EPSG:4326");
      Coordinate centerPoint = new Coordinate(51, 4, 0);
      double radius = 5000;
      CircleByCenterPoint circle = GeometryFactory.createCircleByCenterPoint(crs, centerPoint, radius);
      double minHeight = 500;
      double maxHeight = 2000;
      ExtrudedGeometry extrudedGeometry = GeometryFactory.createExtrudedGeometry(crs, circle, minHeight, maxHeight);
      Parameters:
      reference - the coordinate reference in which the extruded geometry is defined. The horizontal component of this reference must be the same as the horizontal component of the base geometry's coordinate reference. The vertical reference is used to interpret the min and max height values.
      baseGeometry - the geometry to use as a base for the extruded geometry.
      minHeight - the minimum height of the extruded geometry. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      maxHeight - the maximum height of the extruded geometry.If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used.
      Returns:
      the extruded geometry.
      Throws:
      IllegalArgumentException - if the given geometry is not a supported base geometry for an extruded geometry, or if maxHeight < minHeight.
    • createCompositeCurve Link icon

      @NotNull public static CompositeCurve createCompositeCurve(@NotNull List<@NotNull Curve> curveList) throws IllegalArgumentException
      Factory to create a composite curve.

      The following requirements must be met for the curves:

      1. the coordinate references must be the same
      2. the end point of a curve must be same as the start point of the next curve
      Parameters:
      curveList - the curves of which to make a composite curve.
      Returns:
      the composite curve.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createCompositeRing Link icon

      @NotNull public static CompositeRing createCompositeRing(@NotNull List<@NotNull Curve> curveList) throws IllegalArgumentException
      Factory to create a composite ring.

      The following requirements must be met for the curves:

      1. the coordinate references must be the same
      2. the end point of a curve must be same as the start point of the next curve
      3. the end point of the last curve must be the same as the start point of the first curve
      Parameters:
      curveList - the curves of which to make a composite ring.
      Returns:
      the composite ring.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createMultiGeometry Link icon

      @NotNull public static MultiGeometry createMultiGeometry(@NotNull List<@NotNull Geometry> geometryList) throws IllegalArgumentException
      Factory to create a multi-geometry.

      The following requirements must be met for the geometries:

      1. the coordinate references must be the same

      To create a multi-geometry from a list of geometries you can use the following code.

      List<Geometry> geometryList = new ArrayList<>();
      geometryList.add(point);
      geometryList.add(polyline);
      geometryList.add(polygon);
      geometryList.add(circularArcByCenterPoint);
      geometryList.add(arcBand);
      MultiGeometry multiGeometry = GeometryFactory.createMultiGeometry(geometryList);
      Parameters:
      geometryList - the geometries of which to make a multi-geometry; at least one geometry is required.
      Returns:
      the multi-geometry.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createPatch Link icon

      @NotNull public static Patch createPatch(@NotNull Ring baseGeometry) throws IllegalArgumentException
      Factory method to create a patch based on a Ring.

      Example Usage:

      CircleByCenterPoint circleByCenterPoint = GeometryFactory.createCircleByCenterPoint(crs, centerPoint, radius);
      Patch circleByCenterPointPatch = GeometryFactory.createPatch(circleByCenterPoint);

      CircleBy3Points circleBy3Points = GeometryFactory.createCircleBy3Points(crs, startPoint, firstIntermediatePoint, secondIntermediatePoint);
      Patch circleBy3PointsPatch = GeometryFactory.createPatch(circleBy3Points);

      ArcBand arcBand = GeometryFactory.createArcBand(crs, center, minRadius, maxRadius, startAngle, endAngle);
      Patch arcBandPatch = GeometryFactory.createPatch(arcBand);

      Ellipse ellipse = GeometryFactory.createEllipse(crs, centerPoint, a, b, rotAngle);
      Patch ellipsePatch = GeometryFactory.createPatch(ellipse);

      PolylineRing polylineRing = GeometryFactory.createPolylineRing(crs, points, LineInterpolationType.Geodesic);
      Patch polylineRingPatch = GeometryFactory.createPatch(polylineRing);
      Parameters:
      baseGeometry - the base geometry (Ring) for the patch.
      Returns:
      the patch geometry.
      Throws:
      IllegalArgumentException - if the base ring geometry is not supported.
    • createCompositePatch Link icon

      @NotNull public static CompositePatch createCompositePatch(@NotNull Patch exteriorPatch, @NotNull List<@NotNull Patch> interiorPatches) throws IllegalArgumentException
      Factory to create a composite patch.

      The composite patch represents a surface whose boundary is defined by an exterior patch and optionally a number of interior patches which represents holes within the surface.

      The following requirements must be met for the exterior patch and the interior patches:

      1. the coordinate references must be the same

      Creation of composite patch with a hole:

      Patch exteriorPatch = GeometryFactory.createPatch(circleBy3Points);
      Patch interiorPatch = GeometryFactory.createPatch(ellipse);
      List<Patch> interiorPatches = new ArrayList<>();
      interiorPatches.add(interiorPatch);
      CompositePatch compositePatch = GeometryFactory.createCompositePatch(exteriorPatch, interiorPatches);
      Parameters:
      exteriorPatch - the exterior patch of the composite patch surface.
      interiorPatches - the interior patches of the composite patch surface. This can be an empty list.
      Returns:
      the composite patch.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createBezierCurve Link icon

      @NotNull public static BezierCurve createBezierCurve(@NotNull CoordinateReference reference, @NotNull Coordinate startPoint, @NotNull Coordinate controlPoint, @NotNull Coordinate endPoint)
      Factory method to create a quadratic Bezier curve transitioning smoothly between startPoint and endPoint.

      A quadratic Bezier curve is defined by this equation:

       F(t) = startPoint*(1-t)^2 + 2(1-t)*t*controlPoint + endPoint*t^2
       
      Quadratic Bezier Curves
      Quadratic Bezier Curves

      At t=0 (at start), F(t) evaluates to startPoint At t=1 (at end), F(t) evaluates to endPoint

      For other values between 0 and 1, F(t) will evaluate to a quadratic curve tending to controlPoint.

      Parameters:
      reference - the coordinate reference in which the Bezier curve is defined.
      startPoint - first control point of quadratic Bezier curve, start of the curve.
      controlPoint - second control point of quadratic Bezier curve.
      endPoint - third control point of quadratic Bezier curve, end of the curve.
      Returns:
      the line geometry.
    • createRoundedPolyline Link icon

      @NotNull public static CompositeCurve createRoundedPolyline(@NotNull CoordinateReference reference, @NotNull List<@NotNull Coordinate> points, double cornerRoundness) throws IllegalArgumentException
      Factory method to create a curve where pointy corners are replaced by Bezier Curves.

      This method operates by assuming that the points originally define a Polyline. It retains the first and last point and replaces the geometry around vertex (corners) by a BezierCurve. The extent of BezierCurve depends on cornerRoundess. cornerRoundness decides the size of the Bezier Curve such that lower values will result in more pointy geometries.

      This method requires at least 3 points to produce a rounded result. If only 2 points are provided, it will return a standard line. If less than 2 points are provided, this method will throw an Invalid Argument exception. If cornerRoundness is zero, a standard Polyline is created.

      Corner roundness is expected to be between [0,1].

      Rounded Line
      Rounded Line
      Parameters:
      reference - The coordinate reference in which the curve is defined.
      points - Series of points defining the curve. At least 2 points are required to produce a result.
      cornerRoundness - The lower this value, the pointier the geometry will be. This value must be between [0, 1].
      Returns:
      the rounded curve geometry.
      Throws:
      IllegalArgumentException - if the requirements are not met.
    • createRoundedPolylineRing Link icon

      @NotNull public static CompositeRing createRoundedPolylineRing(@NotNull CoordinateReference reference, @NotNull List<@NotNull Coordinate> points, double cornerRoundness) throws IllegalArgumentException
      Factory method to create a ring where pointy corners are replaced by Bezier Curves.

      This method operates by assuming that the points define a PolylineRing and then replace each corner of the ring by a BezierCurve. The extent of BezierCurve depends on cornerRoundess. CornerRoundness decides the size of the Bezier Curve such that lower values will result in more pointy geometries.

      This method requires at least 3 points to produce a result. If less than 3 points are provided, it will throw an Invalid Argument exception. If cornerRoundness is zero, a standard PolylineRing is created.

      Corner roundness is expected to be between [0,1].

      Roundness Factor
      Roundness Factor
      Parameters:
      reference - The coordinate reference in which the curve is defined.
      points - Series of points defining the curve. At least 3 points are required to produce a result.
      cornerRoundness - The lower this value, the pointier the geometry will be. This value must be between [0, 1].
      Returns:
      the rounded ring geometry.
      Throws:
      IllegalArgumentException - if the requirements are not met.