Package org.gdal.ogr

## Class Geometry

- java.lang.Object
- - org.gdal.ogr.Geometry

- All Implemented Interfaces:
    `java.lang.Cloneable`

      public class Geometry
      extends java.lang.Object
      implements java.lang.Cloneable

  Abstract base class for all geometry classes.

  The Geometry class is a binding for the C++ OGRGeometry class.

  Some spatial analysis methods require that OGR is built on the GEOS library to work properly. The precise meaning of methods that describe spatial relationships between geometries is described in the SFCOM, or other simple features interface specifications, like "OpenGIS(R) Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture" (OGC 06-103r3)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Geometry​(int eGeometryType)` | Create an empty geometry of desired type.
    `Geometry​(int eGeometryType, java.lang.String wkt, byte[] wkb, java.lang.String gml)` | Deprecated. Use referenced methods instead.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `AddGeometry​(Geometry other)` | Add a geometry to the container.
    `int` | `AddGeometryDirectly​(Geometry other)` | Add a geometry directly to the container.
    `void` | `AddPoint​(double x, double y)` | Add a point to a geometry (line string or point).
    `void` | `AddPoint​(double x, double y, double z)` | Add a point to a geometry (line string or point).
    `void` | `AddPoint_2D​(double x, double y)` | Add a point to a geometry (line string or point).
    `void` | `AddPointM​(double x, double y, double m)` |
    `void` | `AddPointZM​(double x, double y, double z, double m)` |
    `double` | `Area()` | Compute geometry area.
    `void` | `AssignSpatialReference​(SpatialReference srs)` | Assign spatial reference to this object.
    `Geometry` | `Boundary()` | Compute boundary.
    `Geometry` | `Buffer​(double distance)` | Compute buffer of geometry.
    `Geometry` | `Buffer​(double distance, int quadsecs)` | Compute buffer of geometry.
    `Geometry` | `Buffer​(double distance, java.util.Vector options)` |
    `Geometry` | `BuildArea()` |
    `Geometry` | `Centroid()` | Compute the geometry centroid.
    `java.lang.Object` | `clone()` |
    `Geometry` | `Clone()` | Make a copy of this object.
    `void` | `CloseRings()` | Force rings to be closed.
    `Geometry` | `ConcaveHull​(double ratio, boolean allowHoles)` |
    `Geometry` | `ConstrainedDelaunayTriangulation()` |
    `boolean` | `Contains​(Geometry other)` | Test for containment.
    `Geometry` | `ConvexHull()` | Compute convex hull.
    `int` | `CoordinateDimension()` |
    `static Geometry` | `CreateFromGML​(java.lang.String gml)` | Create geometry from GML.
    `static Geometry` | `CreateFromJson​(java.lang.String json)` | Create geometry from GeoJSON.
    `static Geometry` | `CreateFromWkb​(byte[] wkb)` | Create a geometry object of the appropriate type from it's well known binary representation.
    `static Geometry` | `CreateFromWkt​(java.lang.String wkt)` | Create a geometry object of the appropriate type from it's well known text representation.
    `PreparedGeometry` | `CreatePreparedGeometry()` |
    `boolean` | `Crosses​(Geometry other)` | Test for crossing.
    `Geometry` | `DelaunayTriangulation()` |
    `Geometry` | `DelaunayTriangulation​(double dfTolerance)` |
    `Geometry` | `DelaunayTriangulation​(double dfTolerance, int bOnlyEdges)` |
    `void` | `delete()` | Delete a geometry.
    `Geometry` | `Difference​(Geometry other)` | Compute difference.
    `boolean` | `Disjoint​(Geometry other)` | Test for disjointness.
    `double` | `Distance​(Geometry other)` | Compute distance between two geometries.
    `double` | `Distance3D​(Geometry other)` |
    `void` | `Empty()` | Clear geometry information.
    `boolean` | `Equal​(Geometry other)` | Returns two if two geometries are equivalent.
    `boolean` | `equals​(java.lang.Object obj)` |
    `boolean` | `Equals​(Geometry other)` |
    `java.lang.String` | `ExportToGML()` | Convert a geometry into GML format.
    `java.lang.String` | `ExportToGML​(java.util.Vector options)` | Convert a geometry into GML format.
    `byte[]` | `ExportToIsoWkb()` |
    `byte[]` | `ExportToIsoWkb​(int byte_order)` |
    `int` | `ExportToIsoWkt​(java.lang.String[] argout)` |
    `java.lang.String` | `ExportToJson()` | Convert a geometry into GeoJSON format.
    `java.lang.String` | `ExportToJson​(java.util.Vector options)` | Convert a geometry into GeoJSON format.
    `java.lang.String` | `ExportToKML()` | Convert a geometry into KML format.
    `java.lang.String` | `ExportToKML​(java.lang.String altitude_mode)` | Convert a geometry into KML format.
    `byte[]` | `ExportToWkb()` | Convert a geometry into well known binary format.
    `int` | `ExportToWkb​(byte[] wkbArray, int byte_order)` | Convert a geometry into well known binary format.
    `byte[]` | `ExportToWkb​(int byte_order)` | Convert a geometry into well known binary format.
    `java.lang.String` | `ExportToWkt()` | Convert a geometry into well known text format.
    `int` | `ExportToWkt​(java.lang.String[] argout)` | Convert a geometry into well known text format.
    `void` | `FlattenTo2D()` | Convert geometry to strictly 2D.
    `double` | `GeodesicArea()` |
    `double` | `GeodesicLength()` |
    `double` | `GetArea()` | Deprecated.
    `Geometry` | `GetBoundary()` | Deprecated.
    `int` | `GetCoordinateDimension()` | Get the dimension of the coordinates in this object.
    `Geometry` | `GetCurveGeometry()` |
    `Geometry` | `GetCurveGeometry​(java.util.Vector options)` |
    `int` | `GetDimension()` | Get the dimension of this object.
    `void` | `GetEnvelope​(double[] argout)` | Computes and returns the bounding envelope for this geometry.
    `void` | `GetEnvelope3D​(double[] argout)` | Computes and returns the 3D bounding envelope for this geometry.
    `int` | `GetGeometryCount()` | Fetch the number of elements in a geometry or number of geometries in container.
    `java.lang.String` | `GetGeometryName()` | Fetch WKT name for geometry type.
    `Geometry` | `GetGeometryRef​(int iSubGeom)` | Fetch geometry from a geometry container.
    `int` | `GetGeometryType()` | Fetch geometry type.
    `Geometry` | `GetLinearGeometry()` |
    `Geometry` | `GetLinearGeometry​(double dfMaxAngleStepSizeDegrees)` |
    `Geometry` | `GetLinearGeometry​(double dfMaxAngleStepSizeDegrees, java.util.Vector options)` |
    `double` | `GetM()` |
    `double` | `GetM​(int point)` |
    `double[]` | `GetPoint​(int iPoint)` | Fetch a point in line string or a point geometry.
    `void` | `GetPoint​(int iPoint, double[] argout)` | Fetch a point in line string or a point geometry.
    `double[]` | `GetPoint_2D​(int iPoint)` | Fetch a point in line string or a point geometry.
    `void` | `GetPoint_2D​(int iPoint, double[] argout)` | Fetch a point in line string or a point geometry.
    `int` | `GetPointCount()` | Fetch number of points from a geometry.
    `double[][]` | `GetPoints()` | Returns all points of a point or a line string.
    `double[][]` | `GetPoints​(int nCoordinateDimension)` | Returns all points of a point or a line string.
    `void` | `GetPointZM​(int iPoint, double[] argout)` |
    `SpatialReference` | `GetSpatialReference()` | Returns spatial reference system for object.
    `double` | `GetX()` | Fetch the x coordinate of the first point from a geometry.
    `double` | `GetX​(int ipoint)` | Fetch the x coordinate of a point from a geometry.
    `double` | `GetY()` | Fetch the y coordinate of the first point from a geometry.
    `double` | `GetY​(int ipoint)` | Fetch the y coordinate of a point from a geometry.
    `double` | `GetZ()` | Fetch the z coordinate of the first point from a geometry.
    `double` | `GetZ​(int ipoint)` | Fetch the z coordinate of a point from a geometry.
    `int` | `HasCurveGeometry()` |
    `int` | `HasCurveGeometry​(int bLookForCircular)` |
    `int` | `hashCode()` |
    `boolean` | `Intersect​(Geometry other)` | Deprecated.
    `Geometry` | `Intersection​(Geometry other)` | Compute intersection.
    `boolean` | `Intersects​(Geometry other)` | Do these features intersect?
    `int` | `Is3D()` |
    `boolean` | `IsClockwise()` |
    `boolean` | `IsEmpty()` | Returns true (non-zero) if the object has no points.
    `int` | `IsMeasured()` |
    `boolean` | `IsRing()` | Test if the geometry is a ring.
    `boolean` | `IsSimple()` | Test if the geometry is simple.
    `boolean` | `IsValid()` | Test if the geometry is valid.
    `double` | `Length()` | Returns the length of the geometry
    `Geometry` | `MakeValid()` |
    `Geometry` | `MakeValid​(java.util.Vector options)` |
    `Geometry` | `Normalize()` |
    `boolean` | `Overlaps​(Geometry other)` | Test for overlap.
    `Geometry` | `PointOnSurface()` |
    `Geometry` | `Polygonize()` |
    `int` | `RemoveGeometry​(int iSubGeom)` |
    `Geometry` | `RemoveLowerDimensionSubGeoms()` |
    `void` | `Segmentize​(double max_length)` | Modify the geometry such it has no segment longer then the given distance.
    `void` | `Set3D​(int b3D)` |
    `void` | `SetCoordinateDimension​(int dimension)` | Set the coordinate dimension.
    `void` | `SetMeasured​(int bMeasured)` |
    `void` | `SetPoint​(int ipoint, double x, double y)` | Set the location of a vertex in a point or linestring geometry.
    `void` | `SetPoint​(int ipoint, double x, double y, double z)` | Set the location of a vertex in a point or linestring geometry.
    `void` | `SetPoint_2D​(int ipoint, double x, double y)` | Set the location of a vertex in a point or linestring geometry.
    `void` | `SetPointM​(int point, double x, double y, double m)` |
    `void` | `SetPointZM​(int point, double x, double y, double z, double m)` |
    `Geometry` | `SetPrecision​(double gridSize)` |
    `Geometry` | `SetPrecision​(double gridSize, int flags)` |
    `Geometry` | `Simplify​(double dTolerance)` | Simplify the geometry.
    `Geometry` | `SimplifyPreserveTopology​(double dTolerance)` | Simplify the geometry while preserving topology.
    `void` | `SwapXY()` |
    `Geometry` | `SymDifference​(Geometry other)` | Compute symmetric difference.
    `Geometry` | `SymmetricDifference​(Geometry other)` | Deprecated.
    `boolean` | `Touches​(Geometry other)` | Test for touching.
    `Geometry` | `Transform​(GeomTransformer transformer)` |
    `int` | `Transform​(CoordinateTransformation ct)` | Apply arbitrary coordinate transformation to geometry.
    `int` | `TransformTo​(SpatialReference srs)` | Transform geometry to new spatial reference system.
    `Geometry` | `UnaryUnion()` |
    `Geometry` | `Union​(Geometry other)` | Compute union.
    `Geometry` | `UnionCascaded()` | Compute union using cascading.
    `Geometry` | `Value​(double dfDistance)` |
    `boolean` | `Within​(Geometry other)` | Test for containment.
    `long` | `WkbSize()` |

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Geometry

          public Geometry​(int eGeometryType,
                          java.lang.String wkt,
                          byte[] wkb,
                          java.lang.String gml)

      Deprecated.
      Use referenced methods instead.
      Create a new geometry.

      The geometry can be instantiated by 4 different and exclusive way:

      - By specifying the geometry type (ogr.wkbPoint, etc..)
      - By specifying the well known text representation (wkt)
      - By specifying the well known binary representation (wkb)
      - By specifying the GML representation

      You should rather use either the Geometry(int) constructor, or the static methods like Geometry.CreateFromWkt(), Geometry.CreateFromWbt() or Geometry.CreateFromGML().

      Parameters:
        `eGeometryType` - the type code of the geometry class to be instantiated.
        `wkt` - the well known text representation
        `wkb` - the well known binary representation
        `gml` - the GML representation
      See Also:
        `Geometry(int eGeometryType)`, `CreateFromWkt(String wkt)`, `CreateFromWkb(byte[] wkb)`, `CreateFromGML(String gml)`

    - #### Geometry

          public Geometry​(int eGeometryType)

      Create an empty geometry of desired type.

      The type may be one of ogr.wkbPoint, etc..

      Parameters:
        `eGeometryType` - the type code of the geometry class to be instantiated.

  - ### Method Detail

    - #### delete

          public void delete()

      Delete a geometry.

      Calling this method is not required as normal garbage collection will reclaim associated resources when the object goes out of scope. Otherwise calling delete() explicitly will help release resources sooner. Don't call any method on a deleted object !

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### clone

          public java.lang.Object clone()

    - #### GetPoint_2D

          public double[] GetPoint_2D​(int iPoint)

      Fetch a point in line string or a point geometry.
      Parameters:
        `iPoint` - the vertex to fetch, from 0 to GetNumPoints()-1, zero for a point.
      Returns:
        an allocated array of 2 doubles to contain the x, y coordinates.

    - #### GetPoint

          public double[] GetPoint​(int iPoint)

      Fetch a point in line string or a point geometry.
      Parameters:
        `iPoint` - the vertex to fetch, from 0 to GetNumPoints()-1, zero for a point.
      Returns:
        an allocated array of 3 doubles to contain the x, y, z coordinates.

    - #### CreateFromWkt

          public static Geometry CreateFromWkt​(java.lang.String wkt)

      Create a geometry object of the appropriate type from it's well known text representation.
      Parameters:
        `wkt` - string containing well known text representation of the geometry to be created.
      Returns:
        a geometry on success, or null on error.

    - #### CreateFromWkb

          public static Geometry CreateFromWkb​(byte[] wkb)

      Create a geometry object of the appropriate type from it's well known binary representation.
      Parameters:
        `wkb` - input BLOB data.
      Returns:
        a geometry on success, or null on error.

    - #### CreateFromGML

          public static Geometry CreateFromGML​(java.lang.String gml)

      Create geometry from GML.

      This method translates a fragment of GML containing only the geometry portion into a corresponding Geometry. There are many limitations on the forms of GML geometries supported by this parser, but they are too numerous to list here.

      Parameters:
        `gml` - The GML fragment for the geometry.
      Returns:
        a geometry on success, or null on error.

    - #### CreateFromJson

          public static Geometry CreateFromJson​(java.lang.String json)

      Create geometry from GeoJSON.
      Parameters:
        `json` - GeoJSON content
      Returns:
        a geometry on success, or null on error.

    - #### ExportToWkb

          public int ExportToWkb​(byte[] wkbArray,
                                 int byte_order)

      Convert a geometry into well known binary format.

      This function relates to the SFCOM IWks::ExportToWKB() method.

      Parameters:
        `wkbArray` - a sufficiently large array (at least WkbSize() large) to receive the wkb content.
        `byte_order` - One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
      Returns:
        0 on success. Otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).

    - #### ExportToWkt

          public int ExportToWkt​(java.lang.String[] argout)

      Convert a geometry into well known text format.

      This method relates to the SFCOM IWks::ExportToWKT() method.

      Parameters:
        `argout` - an allocated array of 1 string where the WKT output will be inserted
      Returns:
        Currently 0 is always returned.

    - #### ExportToIsoWkt

          public int ExportToIsoWkt​(java.lang.String[] argout)

    - #### ExportToWkb

          public byte[] ExportToWkb​(int byte_order)

      Convert a geometry into well known binary format.

      This function relates to the SFCOM IWks::ExportToWKB() method.

      Parameters:
        `byte_order` - One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
      Returns:
        the wkb content

    - #### ExportToWkb

          public byte[] ExportToWkb()

      Convert a geometry into well known binary format.

      This function relates to the SFCOM IWks::ExportToWKB() method. MSB order (wkbXDR) will be used.

      Returns:
        the wkb content

    - #### ExportToIsoWkb

          public byte[] ExportToIsoWkb​(int byte_order)

    - #### ExportToIsoWkb

          public byte[] ExportToIsoWkb()

    - #### ExportToGML

          public java.lang.String ExportToGML​(java.util.Vector options)

      Convert a geometry into GML format.

      The GML geometry is expressed directly in terms of GML basic data types assuming the this is available in the gml namespace. The supported options are:

      - FORMAT=GML2/GML3/GML3.2
      - GML3_LINESTRING_ELEMENT=curve. (Only valid for FORMAT=GML3) To use gml:Curve element for linestrings. Otherwise gml:LineString will be used .
      - GML3_LONGSRS=YES/NO. (Only valid for FORMAT=GML3) Default to YES. If YES, SRS with EPSG authority will be written with the "urn:ogc:def:crs:EPSG::" prefix. In the case, if the SRS is a geographic SRS without explicit AXIS order, but that the same SRS authority code imported with ImportFromEPSGA() should be treated as lat/long, then the function will take care of coordinate order swapping. If set to NO, SRS with EPSG authority will be written with the "EPSG:" prefix, even if they are in lat/long order.
      Parameters:
        `options` - a list of strings.
      Returns:
        A GML fragment or null in case of error.

    - #### ExportToGML

          public java.lang.String ExportToGML()

      Convert a geometry into GML format.

      The GML geometry is expressed directly in terms of GML basic data types assuming the this is available in the gml namespace.

      Returns:
        A GML fragment or null in case of error.

    - #### ExportToKML

          public java.lang.String ExportToKML​(java.lang.String altitude_mode)

      Convert a geometry into KML format.
      Parameters:
        `altitude_mode` - string which will be inserted in-between the <altitude_mode> tag.
      Returns:
        A KML fragment or null in case of error.

    - #### ExportToKML

          public java.lang.String ExportToKML()

      Convert a geometry into KML format.
      Returns:
        A KML fragment or null in case of error.

    - #### ExportToJson

          public java.lang.String ExportToJson​(java.util.Vector options)

      Convert a geometry into GeoJSON format.
      Parameters:
        `options` - a list of strings. For now, only COORDINATE_PRECISION=int_number where int_number is the maximum number of figures after decimal separator to write in coordinates.
      Returns:
        A GeoJSON fragment or null in case of error.

    - #### ExportToJson

          public java.lang.String ExportToJson()

      Convert a geometry into GeoJSON format.
      Returns:
        A GeoJSON fragment or null in case of error.

    - #### AddPoint

          public void AddPoint​(double x,
                               double y,
                               double z)

      Add a point to a geometry (line string or point).

      The vertex count of the line string is increased by one, and assigned from the passed location value.

      Parameters:
        `x` - coordinate of point to add.
        `y` - coordinate of point to add.
        `z` - coordinate of point to add.

    - #### AddPoint

          public void AddPoint​(double x,
                               double y)

      Add a point to a geometry (line string or point).

      The vertex count of the line string is increased by one, and assigned from the passed location value.

      Parameters:
        `x` - coordinate of point to add.
        `y` - coordinate of point to add.

    - #### AddPointM

          public void AddPointM​(double x,
                                double y,
                                double m)

    - #### AddPointZM

          public void AddPointZM​(double x,
                                 double y,
                                 double z,
                                 double m)

    - #### AddPoint_2D

          public void AddPoint_2D​(double x,
                                  double y)

      Add a point to a geometry (line string or point).

      The vertex count of the line string is increased by one, and assigned from the passed location value.

      Parameters:
        `x` - x coordinate of point to add.
        `y` - y coordinate of point to add.

    - #### AddGeometryDirectly

          public int AddGeometryDirectly​(Geometry other)

      Add a geometry directly to the container.

      Some subclasses of OGRGeometryCollection restrict the types of geometry that can be added, and may return an error. Ownership of the passed geometry is taken by the container rather than cloning as addGeometry() does.

      There is no SFCOM analog to this method.

      For a polygon, other must be a linearring. If the polygon is empty, the first added subgeometry will be the exterior ring. The next ones will be the interior rings.

      Parameters:
        `other` - geometry to add to the container.
      Returns:
        0 if successful, or throws RuntimeException (or an error code if DontUseExceptions() has been called) if the geometry type is illegal for the type of geometry container.

    - #### AddGeometry

          public int AddGeometry​(Geometry other)

      Add a geometry to the container.

      Some subclasses of OGRGeometryCollection restrict the types of geometry that can be added, and may return an error. The passed geometry is cloned to make an internal copy.

      There is no SFCOM analog to this method.

      For a polygon, other must be a linearring. If the polygon is empty, the first added subgeometry will be the exterior ring. The next ones will be the interior rings.

      Parameters:
        `other` - geometry to add to the container.
      Returns:
        0 if successful, or throws RuntimeException (or an error code if DontUseExceptions() has been called) if the geometry type is illegal for the type of geometry container.

    - #### RemoveGeometry

          public int RemoveGeometry​(int iSubGeom)

    - #### Clone

          public Geometry Clone()

      Make a copy of this object.

      This method relates to the SFCOM IGeometry::clone() method.

      Returns:
        a new object instance with the same geometry, and spatial reference system as the original.

    - #### GetGeometryType

          public int GetGeometryType()

      Fetch geometry type.

      Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.

      Returns:
        the geometry type code.

    - #### GetGeometryName

          public java.lang.String GetGeometryName()

      Fetch WKT name for geometry type.

      There is no SFCOM analog to this method.

      Returns:
        name used for this geometry type in well known text format.

    - #### Length

          public double Length()

      Returns the length of the geometry
      Returns:
        length of the geometry

    - #### Area

          public double Area()

      Compute geometry area.

      Computes the area for an OGRLinearRing, OGRPolygon or OGRMultiPolygon. Undefined for all other geometry types (returns zero).

      Returns:
        the area or 0.0 for unsupported geometry types.

    - #### GeodesicLength

          public double GeodesicLength()

    - #### GeodesicArea

          public double GeodesicArea()

    - #### IsClockwise

          public boolean IsClockwise()

    - #### GetArea

          public double GetArea()

      Deprecated.
      Compute geometry area (deprecated).
      See Also:
        `Area()`

    - #### GetPointCount

          public int GetPointCount()

      Fetch number of points from a geometry.

      Only wkbPoint[25D] or wkbLineString[25D] may return a valid value. Other geometry types will silently return 0.

      Returns:
        the number of points.

    - #### GetPoints

          public double[][] GetPoints​(int nCoordinateDimension)

      Returns all points of a point or a line string.

      This method returns an array of tuples with the [x,y] or [x,y,z] coordinates pair or triplets.

      Only wkbPoint[25D] or wkbLineString[25D] may return a valid value. Other geometry types will return null.

      Parameters:
        `nCoordinateDimension` - if nCoordinateDimension == 0 then the number of coordinates per tuple will reflect the coordinate dimension of the geometry. If nCoordinateDimension == 2, the number of coordinates per tuple will be 2. If nCoordinateDimension == 3, the number of coordinates per tuple will be 3.
      Returns:
        the coordinates

    - #### GetPoints

          public double[][] GetPoints()

      Returns all points of a point or a line string.

      Same as below with nCoordinateDimension == 0

      Returns:
        the coordinates
      See Also:
        `GetPoints(int)`

    - #### GetX

          public double GetX​(int ipoint)

      Fetch the x coordinate of a point from a geometry.
      Parameters:
        `ipoint` - point to get the x coordinate. (must be 0 for a point geometry)
      Returns:
        the X coordinate of this point.

    - #### GetX

          public double GetX()

      Fetch the x coordinate of the first point from a geometry.
      Returns:
        the X coordinate of this point.

    - #### GetY

          public double GetY​(int ipoint)

      Fetch the y coordinate of a point from a geometry.
      Parameters:
        `ipoint` - point to get the y coordinate. (must be 0 for a point geometry)
      Returns:
        the Y coordinate of this point.

    - #### GetY

          public double GetY()

      Fetch the y coordinate of the first point from a geometry.
      Returns:
        the Y coordinate of this point.

    - #### GetZ

          public double GetZ​(int ipoint)

      Fetch the z coordinate of a point from a geometry.
      Parameters:
        `ipoint` - point to get the z coordinate. (must be 0 for a point geometry)
      Returns:
        the Z coordinate of this point.

    - #### GetZ

          public double GetZ()

      Fetch the z coordinate of the first point from a geometry.
      Returns:
        the Z coordinate of this point.

    - #### GetM

          public double GetM​(int point)

    - #### GetM

          public double GetM()

    - #### GetPoint

          public void GetPoint​(int iPoint,
                               double[] argout)

      Fetch a point in line string or a point geometry.
      Parameters:
        `iPoint` - the vertex to fetch, from 0 to GetNumPoints()-1, zero for a point.
        `argout` - an allocated array of 3 doubles to contain the x, y, z coordinates.

    - #### GetPointZM

          public void GetPointZM​(int iPoint,
                                 double[] argout)

    - #### GetPoint_2D

          public void GetPoint_2D​(int iPoint,
                                  double[] argout)

      Fetch a point in line string or a point geometry.
      Parameters:
        `iPoint` - the vertex to fetch, from 0 to GetNumPoints()-1, zero for a point.
        `argout` - an allocated array of 2 doubles to contain the x, y coordinates.

    - #### GetGeometryCount

          public int GetGeometryCount()

      Fetch the number of elements in a geometry or number of geometries in container.

      Only geometries of type wkbPolygon[25D], wkbMultiPoint[25D], wkbMultiLineString[25D], wkbMultiPolygon[25D] or wkbGeometryCollection[25D] may return a valid value. Other geometry types will silently return 0. For a polygon, the returned number is the number of rings (exterior ring + interior rings).

      Returns:
        the number of elements.

    - #### SetPoint

          public void SetPoint​(int ipoint,
                               double x,
                               double y,
                               double z)

      Set the location of a vertex in a point or linestring geometry.

      If ipoint is larger than the number of existing points in the linestring, the point count will be increased to accommodate the request.

      Parameters:
        `ipoint` - the index of the vertex to assign (zero based) or zero for a point.
        `x` - input X coordinate to assign.
        `y` - input Y coordinate to assign.
        `z` - input Z coordinate to assign (defaults to zero).

    - #### SetPoint

          public void SetPoint​(int ipoint,
                               double x,
                               double y)

      Set the location of a vertex in a point or linestring geometry.

      If ipoint is larger than the number of existing points in the linestring, the point count will be increased to accommodate the request.

      Parameters:
        `ipoint` - the index of the vertex to assign (zero based) or zero for a point.
        `x` - input X coordinate to assign.
        `y` - input Y coordinate to assign.

    - #### SetPointM

          public void SetPointM​(int point,
                                double x,
                                double y,
                                double m)

    - #### SetPointZM

          public void SetPointZM​(int point,
                                 double x,
                                 double y,
                                 double z,
                                 double m)

    - #### SetPoint_2D

          public void SetPoint_2D​(int ipoint,
                                  double x,
                                  double y)

      Set the location of a vertex in a point or linestring geometry.

      If ipoint is larger than the number of existing points in the linestring, the point count will be increased to accommodate the request.

      Parameters:
        `ipoint` - the index of the vertex to assign (zero based) or zero for a point.
        `x` - input X coordinate to assign.
        `y` - input Y coordinate to assign.

    - #### SwapXY

          public void SwapXY()

    - #### GetGeometryRef

          public Geometry GetGeometryRef​(int iSubGeom)

      Fetch geometry from a geometry container.

      This function returns a handle to a geometry within the container. The returned geometry remains owned by the container, and should not be modified. The handle is only valid until the next change to the geometry container. Use Clone() to make a copy.

      This function relates to the SFCOM IGeometryCollection::get_Geometry() method.

      For a polygon, OGR_G_GetGeometryRef(iSubGeom) returns the exterior ring if iSubGeom == 0, and the interior rings for iSubGeom > 0.

      Parameters:
        `iSubGeom` - the index of the geometry to fetch, between 0 and GetGeometryCount() - 1.
      Returns:
        requested geometry.

    - #### Simplify

          public Geometry Simplify​(double dTolerance)

      Simplify the geometry.

      This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.

      Parameters:
        `dTolerance` - the distance tolerance for the simplification.
      Returns:
        the simplified geometry or null if an error occurs.

    - #### SimplifyPreserveTopology

          public Geometry SimplifyPreserveTopology​(double dTolerance)

      Simplify the geometry while preserving topology.

      This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.

      Parameters:
        `dTolerance` - the distance tolerance for the simplification.
      Returns:
        the simplified geometry or null if an error occurs.

    - #### DelaunayTriangulation

          public Geometry DelaunayTriangulation​(double dfTolerance,
                                                int bOnlyEdges)

    - #### DelaunayTriangulation

          public Geometry DelaunayTriangulation​(double dfTolerance)

    - #### DelaunayTriangulation

          public Geometry DelaunayTriangulation()

    - #### ConstrainedDelaunayTriangulation

          public Geometry ConstrainedDelaunayTriangulation()

    - #### Polygonize

          public Geometry Polygonize()

    - #### BuildArea

          public Geometry BuildArea()

    - #### Boundary

          public Geometry Boundary()

      Compute boundary.

      A new geometry object is created and returned containing the boundary of the geometry on which the method is invoked.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Returns:
        a newly allocated geometry now owned by the caller, or null on failure.

    - #### GetBoundary

          public Geometry GetBoundary()

      Deprecated.
      Compute boundary (deprecated).
      See Also:
        `Boundary()`

    - #### ConvexHull

          public Geometry ConvexHull()

      Compute convex hull.

      A new geometry object is created and returned containing the convex hull of the geometry on which the method is invoked.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Returns:
        a newly allocated geometry now owned by the caller, or null on failure.

    - #### ConcaveHull

          public Geometry ConcaveHull​(double ratio,
                                      boolean allowHoles)

    - #### MakeValid

          public Geometry MakeValid​(java.util.Vector options)

    - #### MakeValid

          public Geometry MakeValid()

    - #### SetPrecision

          public Geometry SetPrecision​(double gridSize,
                                       int flags)

    - #### SetPrecision

          public Geometry SetPrecision​(double gridSize)

    - #### Normalize

          public Geometry Normalize()

    - #### RemoveLowerDimensionSubGeoms

          public Geometry RemoveLowerDimensionSubGeoms()

    - #### Buffer

          public Geometry Buffer​(double distance,
                                 int quadsecs)

      Compute buffer of geometry.

      Builds a new geometry containing the buffer region around the geometry on which it is invoked. The buffer is a polygon containing the region within the buffer distance of the original geometry.

      Some buffer sections are properly described as curves, but are converted to approximate polygons. The nQuadSegs parameter can be used to control how many segments should be used to define a 90 degree curve - a quadrant of a circle. A value of 30 is a reasonable default. Large values result in large numbers of vertices in the resulting buffer geometry while small numbers reduce the accuracy of the result.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `distance` - the buffer distance to be applied.
        `quadsecs` - the number of segments used to approximate a 90 degree (quadrant) of curvature.
      Returns:
        the newly created geometry, or null if an error occurs.

    - #### Buffer

          public Geometry Buffer​(double distance)

      Compute buffer of geometry.

      Same as below with quadsecs == 30.

      See Also:
        `Buffer(double distance, int quadsecs)`

    - #### Buffer

          public Geometry Buffer​(double distance,
                                 java.util.Vector options)

    - #### Intersection

          public Geometry Intersection​(Geometry other)

      Compute intersection.

      Generates a new geometry which is the region of intersection of the two geometries operated on. The Intersects() method can be used to test if two geometries intersect.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the other geometry intersected with "this" geometry.
      Returns:
        a new geometry representing the intersection or null if there is no intersection or an error occurs.
      See Also:
        `Intersects(Geometry)`

    - #### Union

          public Geometry Union​(Geometry other)

      Compute union.

      Generates a new geometry which is the region of union of the two geometries operated on.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the other geometry unioned with "this" geometry.
      Returns:
        a new geometry representing the union or null if an error occurs.

    - #### UnionCascaded

          public Geometry UnionCascaded()

      Compute union using cascading.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.

      Returns:
        a new geometry representing the union or null if an error occurs.

    - #### UnaryUnion

          public Geometry UnaryUnion()

    - #### Difference

          public Geometry Difference​(Geometry other)

      Compute difference.

      Generates a new geometry which is the region of this geometry with the region of the second geometry removed.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the other geometry removed from "this" geometry.
      Returns:
        a new geometry representing the difference or null if the difference is empty or an error occurs.

    - #### SymDifference

          public Geometry SymDifference​(Geometry other)

      Compute symmetric difference.

      Generates a new geometry which is the symmetric difference of this geometry and the second geometry passed into the method.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the other geometry.
      Returns:
        a new geometry representing the symmetric difference or null if the difference is empty or an error occurs.

    - #### SymmetricDifference

          public Geometry SymmetricDifference​(Geometry other)

      Deprecated.
      Compute symmetric difference (deprecated).
      See Also:
        `SymDifference(Geometry)`

    - #### Distance

          public double Distance​(Geometry other)

      Compute distance between two geometries.

      Returns the shortest distance between the two geometries.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the other geometry to compare against.
      Returns:
        the distance between the geometries or -1 if an error occurs.

    - #### Distance3D

          public double Distance3D​(Geometry other)

    - #### Empty

          public void Empty()

      Clear geometry information.

      This restores the geometry to it's initial state after construction, and before assignment of actual geometry.

      This method relates to the SFCOM IGeometry::Empty() method.

    - #### IsEmpty

          public boolean IsEmpty()

      Returns true (non-zero) if the object has no points.

      Normally this returns false except between when an object is instantiated and points have been assigned. This method relates to the SFCOM IGeometry::IsEmpty() method.

      Returns:
        true if object is empty, otherwise false.

    - #### IsValid

          public boolean IsValid()

      Test if the geometry is valid.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return false.

      Returns:
        true if the geometry has no points, otherwise false.

    - #### IsSimple

          public boolean IsSimple()

      Test if the geometry is simple.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return false.

      Returns:
        true if the geometry has no points, otherwise false.

    - #### IsRing

          public boolean IsRing()

      Test if the geometry is a ring.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return false.

      Returns:
        true if the geometry has no points, otherwise false.

    - #### Intersects

          public boolean Intersects​(Geometry other)

      Do these features intersect?

      Determines whether two geometries intersect. If GEOS is enabled, then this is done in rigorous fashion otherwise true is returned if the envelopes (bounding boxes) of the two features overlap.

      The geom argument may be safely null, but in this case the method will always return true. That is, a null geometry is treated as being everywhere.

      Parameters:
        `other` - the other geometry to test against.
      Returns:
        true if the geometries intersect, otherwise false.

    - #### Intersect

          public boolean Intersect​(Geometry other)

      Deprecated.
      Do these features intersect?
      See Also:
        `Intersects(Geometry)`

    - #### Equals

          public boolean Equals​(Geometry other)

    - #### Equal

          public boolean Equal​(Geometry other)

      Returns two if two geometries are equivalent.
      Returns:
        true if equivalent or false otherwise.

    - #### Disjoint

          public boolean Disjoint​(Geometry other)

      Test for disjointness.

      Tests if this geometry and the other passed into the method are disjoint.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if they are disjoint, otherwise false.

    - #### Touches

          public boolean Touches​(Geometry other)

      Test for touching.

      Tests if this geometry and the other passed into the method are touching. This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if they are touching, otherwise false.

    - #### Crosses

          public boolean Crosses​(Geometry other)

      Test for crossing.

      Tests if this geometry and the other passed into the method are crossing.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if they are crossing, otherwise false.

    - #### Within

          public boolean Within​(Geometry other)

      Test for containment.

      Tests if actual geometry object is within the passed geometry. This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if poOtherGeom is within this geometry, otherwise false.

    - #### Contains

          public boolean Contains​(Geometry other)

      Test for containment.

      Tests if actual geometry object contains the passed geometry.

      This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if poOtherGeom contains this geometry, otherwise false

    - #### Overlaps

          public boolean Overlaps​(Geometry other)

      Test for overlap.

      Tests if this geometry and the other passed into the method overlap, that is their intersection has a non-zero area. This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail.

      Parameters:
        `other` - the geometry to compare to this geometry.
      Returns:
        true if they are overlapping, otherwise false.

    - #### TransformTo

          public int TransformTo​(SpatialReference srs)

      Transform geometry to new spatial reference system.

      This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.

      This method will only work if the geometry already has an assigned spatial reference system, and if it is transformable to the target coordinate system.

      Because this method requires internal creation and initialization of an CoordinateTransformation object it is significantly more expensive to use this method to transform many geometries than it is to create the CoordinateTransformation in advance, and call transform() with that transformation. This method exists primarily for convenience when only transforming a single geometry.

      Parameters:
        `srs` - spatial reference system to transform to.
      Returns:
        0 on success. Otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).

    - #### Transform

          public int Transform​(CoordinateTransformation ct)

      Apply arbitrary coordinate transformation to geometry.

      This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.

      Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the CoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the CoordinateTransformation will be assigned to the geometry.

      Parameters:
        `ct` - the transformation to apply.
      Returns:
        0 on success. Otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).

    - #### GetSpatialReference

          public SpatialReference GetSpatialReference()

      Returns spatial reference system for object.

      This method relates to the SFCOM IGeometry::get_SpatialReference() method.

      Returns:
        a reference to the spatial reference object. The object may be shared with many geometry objects, and should not be modified.

    - #### AssignSpatialReference

          public void AssignSpatialReference​(SpatialReference srs)

      Assign spatial reference to this object.

      Any existing spatial reference is replaced, but under no circumstances does this result in the object being reprojected. It is just changing the interpretation of the existing geometry. Note that assigning a spatial reference increments the reference count on the SpatialReference, but does not copy it. This is similar to the SFCOM IGeometry::put_SpatialReference() method.

      Parameters:
        `srs` - new spatial reference system to apply.

    - #### CloseRings

          public void CloseRings()

      Force rings to be closed.

      If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

    - #### FlattenTo2D

          public void FlattenTo2D()

      Convert geometry to strictly 2D.

      In a sense this converts all Z coordinates to 0.0.

    - #### Segmentize

          public void Segmentize​(double max_length)

      Modify the geometry such it has no segment longer then the given distance.

      Interpolated points will have Z and M values (if needed) set to 0. Distance computation is performed in 2d only

      Parameters:
        `max_length` - the maximum distance between 2 points after segmentization

    - #### GetEnvelope

          public void GetEnvelope​(double[] argout)

      Computes and returns the bounding envelope for this geometry.

      Parameters:
        `argout` - an allocated array of 4 doubles into which to place the result

    - #### GetEnvelope3D

          public void GetEnvelope3D​(double[] argout)

      Computes and returns the 3D bounding envelope for this geometry.

      Parameters:
        `argout` - an allocated array of 6 doubles into which to place the result

    - #### Centroid

          public Geometry Centroid()

      Compute the geometry centroid. The centroid is not necessarily within the geometry.

      This method relates to the SFCOM ISurface::get_Centroid() method however the current implementation based on GEOS can operate on other geometry types such as multipoint, linestring, geometrycollection such as multipolygons. OGC SF SQL 1.1 defines the operation for surfaces (polygons). SQL/MM-Part 3 defines the operation for surfaces and multisurfaces (multipolygons).

      This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.

      Returns:
        point with the centroid location, or null in case of failure

    - #### PointOnSurface

          public Geometry PointOnSurface()

    - #### WkbSize

          public long WkbSize()

    - #### GetCoordinateDimension

          public int GetCoordinateDimension()

      Get the dimension of the coordinates in this object.

      This method corresponds to the SFCOM IGeometry::GetDimension() method.

      Returns:
        in practice this always returns 2 indicating that coordinates are specified within a two dimensional space.

    - #### CoordinateDimension

          public int CoordinateDimension()

    - #### Is3D

          public int Is3D()

    - #### IsMeasured

          public int IsMeasured()

    - #### SetCoordinateDimension

          public void SetCoordinateDimension​(int dimension)

      Set the coordinate dimension.

      This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. Setting the dimension of a geometry collection will not necessarily affect the children geometries.

      Parameters:
        `dimension` - New coordinate dimension value, either 2 or 3.

    - #### Set3D

          public void Set3D​(int b3D)

    - #### SetMeasured

          public void SetMeasured​(int bMeasured)

    - #### GetDimension

          public int GetDimension()

      Get the dimension of this object.

      This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by GetCoordinateDimension()).

      Returns:
        0 for points, 1 for lines and 2 for surfaces.

    - #### HasCurveGeometry

          public int HasCurveGeometry​(int bLookForCircular)

    - #### HasCurveGeometry

          public int HasCurveGeometry()

    - #### GetLinearGeometry

          public Geometry GetLinearGeometry​(double dfMaxAngleStepSizeDegrees,
                                            java.util.Vector options)

    - #### GetLinearGeometry

          public Geometry GetLinearGeometry​(double dfMaxAngleStepSizeDegrees)

    - #### GetLinearGeometry

          public Geometry GetLinearGeometry()

    - #### GetCurveGeometry

          public Geometry GetCurveGeometry​(java.util.Vector options)

    - #### GetCurveGeometry

          public Geometry GetCurveGeometry()

    - #### Value

          public Geometry Value​(double dfDistance)

    - #### Transform

          public Geometry Transform​(GeomTransformer transformer)

    - #### CreatePreparedGeometry

          public PreparedGeometry CreatePreparedGeometry()

    - #### ExportToWkt

          public java.lang.String ExportToWkt()

      Convert a geometry into well known text format.

      This method relates to the SFCOM IWks::ExportToWKT() method.

      Returns:
        the WKT string