org.gdal.ogr

## Class Geometry

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

- All Implemented Interfaces:
    Cloneable

      public class Geometry
      extends Object
      implements 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 and Description
    `Geometry(int eGeometryType)` Create an empty geometry of desired type.
    `Geometry(int eGeometryType, String wkt, byte[] wkb, String gml)` Deprecated. Use referenced methods instead.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `AddGeometry(Geometry other)` Add a geometry to the container.
    `int` | `AddGeometryDirectly(Geometry other)` Add a geometry directly to the container.
    `void` | `AddPoint_2D(double x, double y)` Add a point to a geometry (line string or point).
    `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).
    `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` | `Centroid()` Compute the geometry centroid.
    `Object` | `clone()`
    `Geometry` | `Clone()` Make a copy of this object.
    `void` | `CloseRings()` Force rings to be closed.
    `boolean` | `Contains(Geometry other)` Test for containment.
    `Geometry` | `ConvexHull()` Compute convex hull.
    `static Geometry` | `CreateFromGML(String gml)` Create geometry from GML.
    `static Geometry` | `CreateFromJson(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(String wkt)` Create a geometry object of the appropriate type from it's well known text representation.
    `boolean` | `Crosses(Geometry other)` Test for crossing.
    `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.
    `void` | `Empty()` Clear geometry information.
    `boolean` | `Equal(Geometry other)` Returns two if two geometries are equivalent.
    `boolean` | `Equals(Geometry other)`
    `boolean` | `equals(Object obj)`
    `String` | `ExportToGML()` Convert a geometry into GML format.
    `String` | `ExportToGML(Vector options)` Convert a geometry into GML format.
    `byte[]` | `ExportToIsoWkb()`
    `byte[]` | `ExportToIsoWkb(int byte_order)`
    `int` | `ExportToIsoWkt(String[] argout)`
    `String` | `ExportToJson()` Convert a geometry into GeoJSON format.
    `String` | `ExportToJson(Vector options)` Convert a geometry into GeoJSON format.
    `String` | `ExportToKML()` Convert a geometry into KML format.
    `String` | `ExportToKML(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.
    `String` | `ExportToWkt()` Convert a geometry into well known text format.
    `int` | `ExportToWkt(String[] argout)` Convert a geometry into well known text format.
    `void` | `FlattenTo2D()` Convert geometry to strictly 2D.
    `double` | `GetArea()` Deprecated.
    `Geometry` | `GetBoundary()` Deprecated.
    `int` | `GetCoordinateDimension()` Get the dimension of the coordinates in this object.
    `Geometry` | `GetCurveGeometry()`
    `Geometry` | `GetCurveGeometry(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.
    `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, Vector options)`
    `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.
    `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.
    `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.
    `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?
    `boolean` | `IsEmpty()` Returns true (non-zero) if the object has no points.
    `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
    `boolean` | `Overlaps(Geometry other)` Test for overlap.
    `Geometry` | `PointOnSurface()`
    `void` | `Segmentize(double max_length)` Modify the geometry such it has no segment longer then the given distance.
    `void` | `SetCoordinateDimension(int dimension)` Set the coordinate dimension.
    `void` | `SetPoint_2D(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)` 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.
    `Geometry` | `Simplify(double dTolerance)` Simplify the geometry.
    `Geometry` | `SimplifyPreserveTopology(double dTolerance)` Simplify the geometry while preserving topology.
    `Geometry` | `SymDifference(Geometry other)` Compute symmetric difference.
    `Geometry` | `SymmetricDifference(Geometry other)` Deprecated.
    `boolean` | `Touches(Geometry other)` Test for touching.
    `int` | `Transform(CoordinateTransformation ct)` Apply arbitrary coordinate transformation to geometry.
    `int` | `TransformTo(SpatialReference srs)` Transform geometry to new spatial reference system.
    `Geometry` | `Union(Geometry other)` Compute union.
    `Geometry` | `UnionCascaded()` Compute union using cascading.
    `Geometry` | `Value(double dfDistance)`
    `boolean` | `Within(Geometry other)` Test for containment.
    `int` | `WkbSize()` Returns size of related binary representation.

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

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

- - ### Constructor Detail

    - #### Geometry

          public Geometry(int eGeometryType,
                  String wkt,
                  byte[] wkb,
                  String gml)

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

      The geometry can be instanciated 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.
      Since:
        Java bindings 1.7.0

  - ### 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(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `Object`

    - #### 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.
      Since:
        Java bindings 1.7.0

    - #### 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.
      Since:
        Java bindings 1.7.0

    - #### CreateFromWkt

          public static Geometry CreateFromWkt(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 succes, or null on error.
      Since:
        Java bindings 1.7.0

    - #### 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 succes, or null on error.
      Since:
        Java bindings 1.7.0

    - #### CreateFromGML

          public static Geometry CreateFromGML(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 succes, or null on error.
      Since:
        Java bindings 1.7.0

    - #### CreateFromJson

          public static Geometry CreateFromJson(String json)

      Create geometry from GeoJSON.
      Parameters:
        `json` - GeoJSON content
      Returns:
        a geometry on succes, or null on error.
      Since:
        Java bindings 1.7.0

    - #### 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(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(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
      Since:
        Java bindings 1.7.0

    - #### 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
      Since:
        Java bindings 1.7.0

    - #### ExportToIsoWkb

          public byte[] ExportToIsoWkb(int byte_order)

    - #### ExportToIsoWkb

          public byte[] ExportToIsoWkb()

    - #### ExportToGML

          public String ExportToGML(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 in OGR 1.8.0 are :

      - FORMAT=GML3. Otherwise it will default to GML 2.1.2 output.
      - 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.
      Since:
        OGR 1.8.0

    - #### ExportToGML

          public 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 String ExportToKML(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 String ExportToKML()

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

    - #### ExportToJson

          public String ExportToJson(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.
      Since:
        OGR 1.9.0

    - #### ExportToJson

          public 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.
      Since:
        Java bindings 1.7.0

    - #### 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.

    - #### 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 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
      Since:
        Java bindings 1.8.0

    - #### 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.
      Since:
        OGR 1.8.0

    - #### 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
      Since:
        OGR 1.9.0

    - #### GetPoints

          public double[][] GetPoints()

      Returns all points of a point or a line string.

      Same as below with nCoordinateDimension == 0

      Returns:
        the coordinates
      Since:
        OGR 1.9.0
      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.
      Since:
        Java bindings 1.7.0

    - #### 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.
      Since:
        Java bindings 1.7.0

    - #### 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.
      Since:
        Java bindings 1.7.0

    - #### 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.

    - #### 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.
      Since:
        Java bindings 1.7.0

    - #### 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.

    - #### GetGeometryRef

          public Geometry GetGeometryRef(int iSubGeom)

      Fetch geometry from a geometry container.

      This function returns an 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 untill 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.
      Since:
        OGR 1.8.0

    - #### 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.
      Since:
        OGR 1.9.0

    - #### 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.
      Since:
        OGR 1.8.0

    - #### 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.

    - #### 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 segements 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.

      Since:
        Java bindings 1.7.0
      See Also:
        `Buffer(double distance, int quadsecs)`

    - #### 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.
      Since:
        OGR 1.8.0

    - #### 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.
      Since:
        OGR 1.8.0

    - #### 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.

    - #### 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 rigerous 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.
      Since:
        OGR 1.8.0

    - #### 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
      Since:
        Java bindings 1.7.0

    - #### 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
      Since:
        OGR 1.9.0

    - #### 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 int WkbSize()

      Returns size of related binary representation.

      This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries. This method relates to the SFCOM IWks::WkbSize() method.

      Returns:
        size of binary representation in bytes.

    - #### 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.

    - #### 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.

    - #### 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,
                                   Vector options)

    - #### GetLinearGeometry

          public Geometry GetLinearGeometry(double dfMaxAngleStepSizeDegrees)

    - #### GetLinearGeometry

          public Geometry GetLinearGeometry()

    - #### GetCurveGeometry

          public Geometry GetCurveGeometry(Vector options)

    - #### GetCurveGeometry

          public Geometry GetCurveGeometry()

    - #### Value

          public Geometry Value(double dfDistance)

    - #### ExportToWkt

          public String ExportToWkt()

      Convert a geometry into well known text format.

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

      Returns:
        the WKT string
      Since:
        Java bindings 1.7.0