Package org.gdal.osr

Class SpatialReference

java.lang.Object
org.gdal.osr.SpatialReference
All Implemented Interfaces:
Cloneable

public class SpatialReference extends Object implements Cloneable
This class represents an OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format. This object is reference counted as one instance of the object is normally shared between many Geometry objects.

The SpatialReference class is a binding for the C++ OGRSpatialReference class.

Normally application code can fetch needed parameter values for this SRS using GetAttrValue(), but in special cases the underlying parse tree (or OGR_SRSNode objects) can be accessed more directly.

See the tutorial for more information on how to use this class.

  • Constructor Details

    • SpatialReference

      public SpatialReference(String wkt)
      Constructor.

      This constructor takes an optional string argument which if passed should be a WKT representation of an SRS. Passing this is equivalent to not passing it, and then calling importFromWkt() with the WKT string.

      Note that newly created objects are given a reference count of one.

      Parameters:
      wkt - well known text definition to which the object should be initialized, or null (the default).
    • SpatialReference

      public SpatialReference()
      Constructor.

      Same as below with wkt == null.

      Since:
      Java bindings 1.7.0
      See Also:
  • Method Details

    • delete

      public void delete()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      public Object clone()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Convert this SRS into a pretty WKT format.
      Overrides:
      toString in class Object
      Returns:
      the srs
    • ExportToWkt

      public String ExportToWkt()
      Convert this SRS into WKT format.

      Same as below but the string is returned as a return value

      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToPrettyWkt

      public String ExportToPrettyWkt(int simplify)
      Convert this SRS into a nicely formatted WKT string for display to a person.

      Same as below but the string is returned as a return value

      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToPrettyWkt

      public String ExportToPrettyWkt()
      Convert this SRS into a nicely formatted WKT string for display to a person.

      Same as below with simplify == 0 and the string is returned as a return value

      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToProj4

      public String ExportToProj4()
      Export coordinate system in PROJ.4 format.

      Same as below but the string is returned as a return value

      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToXML

      public String ExportToXML(String dialect)
      Export coordinate system in XML format.
      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToXML

      public String ExportToXML()
      Export coordinate system in XML format.
      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToMICoordSys

      public String ExportToMICoordSys()
      Export coordinate system in Mapinfo style CoordSys format.
      Returns:
      the coordinate system in Mapinfo style CoordSys format.
      Since:
      Java bindings 1.7.0
    • GetTOWGS84

      public double[] GetTOWGS84()
      Fetch TOWGS84 parameters, if available.
      Returns:
      an array of doubles into which up to 7 coefficients are placed.
      Since:
      Java bindings 1.7.0
    • SetTOWGS84

      public int SetTOWGS84(double p1, double p2, double p3)
      Set the Bursa-Wolf conversion to WGS84.

      Same as below with dfEX == dfEY == dfEZ == dfPPM == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • __str__

      public String __str__()
      Convert this SRS into a pretty WKT format.
      Returns:
      the srs
    • GetName

      public String GetName()
    • IsSame

      public int IsSame(SpatialReference rhs, Vector options)
    • IsSame

      public int IsSame(SpatialReference other)
      Do these two spatial references describe the same system ?
      Parameters:
      other - the SRS being compared to.
      Returns:
      1 if equivalent or 0 otherwise.
    • IsSameGeogCS

      public int IsSameGeogCS(SpatialReference other)
      Do the GeogCS'es match?
      Parameters:
      other - the SRS being compared against.
      Returns:
      1 if they are the same or 0 otherwise.
    • IsSameVertCS

      public int IsSameVertCS(SpatialReference other)
      Do the VertCS'es match?
      Parameters:
      other - the SRS being compared against.
      Returns:
      1 if they are the same or 0 otherwise.
    • IsGeographic

      public int IsGeographic()
      Check if geographic coordinate system.
      Returns:
      1 if this spatial reference is geographic ... that is the root is a GEOGCS node.
    • IsDerivedGeographic

      public int IsDerivedGeographic()
    • IsProjected

      public int IsProjected()
      Check if projected coordinate system.
      Returns:
      1 if this contains a PROJCS node indicating a it is a projected coordinate system.
    • IsCompound

      public int IsCompound()
      Check if coordinate system is compound.
      Returns:
      1 if this is rooted with a COMPD_CS node.
      Since:
      GDAL 1.9.0
    • IsGeocentric

      public int IsGeocentric()
      Check if geocentric coordinate system.
      Returns:
      1 if this contains a GEOCCS node indicating a it is a geocentric coordinate system.
      Since:
      GDAL 1.9.0
    • IsLocal

      public int IsLocal()
      Check if local coordinate system.
      Returns:
      1 if this spatial reference is local ... that is the root is a LOCAL_CS node.
    • IsVertical

      public int IsVertical()
      Check if vertical coordinate system.
      Returns:
      1 if this contains a VERT_CS node indicating a it is a vertical coordinate system.
      Since:
      OGR 1.8.0
    • IsDynamic

      public boolean IsDynamic()
    • HasPointMotionOperation

      public boolean HasPointMotionOperation()
    • GetCoordinateEpoch

      public double GetCoordinateEpoch()
    • SetCoordinateEpoch

      public void SetCoordinateEpoch(double coordinateEpoch)
    • EPSGTreatsAsLatLong

      public int EPSGTreatsAsLatLong()
      This method returns TRUE if EPSG feels this geographic coordinate system should be treated as having lat/long coordinate ordering.

      Currently this returns TRUE for all geographic coordinate systems with an EPSG code set, and AXIS values set defining it as lat, long. Note that coordinate systems with an EPSG code and no axis settings will be assumed to not be lat/long.

      FALSE will be returned for all coordinate systems that are not geographic, or that do not have an EPSG code set.

      Returns:
      TRUE or FALSE.
    • EPSGTreatsAsNorthingEasting

      public int EPSGTreatsAsNorthingEasting()
    • SetAuthority

      public int SetAuthority(String target_key, String authority, int code)
      Set the authority for a node.
      Parameters:
      target_key - the partial or complete path to the node to set an authority on. i.e. "PROJCS", "GEOGCS" or "GEOGCS|UNIT".
      authority - authority name, such as "EPSG".
      code - code for value with this authority.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • GetAttrValue

      public String GetAttrValue(String name, int child)
      Fetch indicated attribute of named node.

      This method uses GetAttrNode() to find the named node, and then extracts the value of the indicated child. Thus a call to GetAttrValue("UNIT",1) would return the second child of the UNIT node, which is normally the length of the linear unit in meters.

      Parameters:
      name - the tree node to look for (case insensitive).
      child - the child of the node to fetch (zero based).
      Returns:
      the requested value, or null if it fails for any reason.
    • GetAttrValue

      public String GetAttrValue(String name)
      Fetch first attribute of named node.

      This method uses GetAttrNode() to find the named node, and then extracts the value of the first child.

      Parameters:
      name - the tree node to look for (case insensitive).
      Returns:
      the requested value, or null if it fails for any reason.
      Since:
      Java bindings 1.7.0
    • SetAttrValue

      public int SetAttrValue(String name, String value)
      Set attribute value in spatial reference.

      Missing intermediate nodes in the path will be created if not already in existence. If the attribute has no children one will be created and assigned the value otherwise the zeroth child will be assigned the value.

      Parameters:
      name - full path to attribute to be set. For instance "PROJCS|GEOGCS|UNITS".
      value - value to be assigned to node, such as "meter". This may be null if you just want to force creation of the intermediate path.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetAngularUnits

      public int SetAngularUnits(String name, double to_radians)
      Set the angular units for the geographic coordinate system.

      This method creates a UNITS subnode with the specified values as a child of the GEOGCS node.

      Parameters:
      name - the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UA_DEGREE.
      to_radians - the value to multiple by an angle in the indicated units to transform to radians. Some standard conversion factors can be found in ogr_srs_api.h.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • GetAngularUnits

      public double GetAngularUnits()
      Fetch angular geographic coordinate system units.

      If no units are available, a value of SRS_UA_DEGREE_CONV will be assumed. This method only checks directly under the GEOGCS node for units.

      Returns:
      the value to multiply by angular distances to transform them to radians.
    • GetAngularUnitsName

      public String GetAngularUnitsName()
      Fetch angular geographic coordinate system units name.

      If no units are available, a value of "degree" will be assumed. This method only checks directly under the GEOGCS node for units.

      Returns:
      the units name
      Since:
      Java bindings 2.1.0
    • SetTargetLinearUnits

      public int SetTargetLinearUnits(String target, String name, double to_meters)
      Set the linear units for the projection.

      This method creates a UNIT subnode with the specified values as a child of the target node.

      Parameters:
      target - the keyword to set the linear units for. i.e. "PROJCS" or "VERT_CS"
      name - the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.
      to_meters - the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.
      Returns:
      OGRERR_NONE on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
      Since:
      OGR 1.9.0
    • SetLinearUnits

      public int SetLinearUnits(String name, double to_meters)
      Set the linear units for the projection.

      This method creates a UNITS subnode with the specified values as a child of the PROJCS or LOCAL_CS node.

      Parameters:
      name - the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.
      to_meters - the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetLinearUnitsAndUpdateParameters

      public int SetLinearUnitsAndUpdateParameters(String name, double to_meters)
      Set the linear units for the projection.

      This method creates a UNITS subnode with the specified values as a child of the PROJCS or LOCAL_CS node. It works the same as the SetLinearUnits() method, but it also updates all existing linear projection parameter values from the old units to the new units.

      Parameters:
      name - the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.
      to_meters - the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • GetTargetLinearUnits

      public double GetTargetLinearUnits(String target_key)
    • GetLinearUnits

      public double GetLinearUnits()
      Fetch linear projection units.

      If no units are available, a value of "Meters" and 1.0 will be assumed. This method only checks directly under the PROJCS or LOCAL_CS node for units.

      Returns:
      the value to multiply by linear distances to transform them to meters.
    • GetLinearUnitsName

      public String GetLinearUnitsName()
      Fetch linear projection units name.

      If no units are available, a value of "Meters" will be assumed. This method only checks directly under the PROJCS or LOCAL_CS node for units.

      Returns:
      the units name
    • GetAuthorityCode

      public String GetAuthorityCode(String target_key)
      Get the authority code for a node.

      This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the code value.

      While in theory values may be non-numeric, for the EPSG authority all code values should be integral.

      Parameters:
      target_key - the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or null to search for an authority node on the root element.
      Returns:
      value code from authority node, or null on failure.
    • GetAuthorityName

      public String GetAuthorityName(String target_key)
      Get the authority name for a node.

      This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the authority name value.

      The most common authority is "EPSG".

      Parameters:
      target_key - the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or null to search for an authority node on the root element.
      Returns:
      value code from authority node, or null on failure.
    • GetAreaOfUse

      public AreaOfUse GetAreaOfUse()
    • GetAxisName

      public String GetAxisName(String target_key, int iAxis)
      Get the axis name for a node.

      This method is used to query an AXIS[] node from within the WKT tree, and fetch the axis name value.

      Parameters:
      target_key - the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS" or null to search for an authority node on the root element.
      iAxis - axis index (starting with 0)
      Returns:
      axis name, or null on failure.
      Since:
      GDAL 2.1
    • GetAxesCount

      public int GetAxesCount()
    • GetAxisOrientation

      public int GetAxisOrientation(String target_key, int iAxis)
      Get the axis orientation for a node.

      This method is used to query an AXIS[] node from within the WKT tree, and fetch the axis orientation value.

      Parameters:
      target_key - the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS" or null to search for an authority node on the root element.
      iAxis - axis index (starting with 0)
      Returns:
      axis orientation (org.gdal.osr.osr.OAO_Other, org.gdal.osr.osr.OAO_North, org.gdal.osr.osr.OAO_South, org.gdal.osr.osr.OAO_East, org.gdal.osr.osr.OAO_West, org.gdal.osr.osr.OAO_Up, org.gdal.osr.osr.OAO_Down), or org.gdal.osr.osr.OAO_Other on failure.
      Since:
      GDAL 2.1
    • GetAxisMappingStrategy

      public int GetAxisMappingStrategy()
    • SetAxisMappingStrategy

      public void SetAxisMappingStrategy(int strategy)
    • GetDataAxisToSRSAxisMapping

      public int[] GetDataAxisToSRSAxisMapping(SWIGTYPE_p_int nLen, SWIGTYPE_p_p_int pList)
    • SetDataAxisToSRSAxisMapping

      public int SetDataAxisToSRSAxisMapping(int[] nList)
    • SetUTM

      public int SetUTM(int zone, int north)
      Set UTM projection definition.

      This will generate a projection definition with the full set of transverse mercator projection parameters for the given UTM zone. If no PROJCS[] description is set yet, one will be set to look like "UTM Zone %d, {Northern, Southern} Hemisphere".

      Parameters:
      zone - UTM zone.
      north - 1 for northern hemisphere, or 0 for southern hemisphere.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetUTM

      public int SetUTM(int zone)
      Set UTM projection definition.

      Same as below with north == 1

      Since:
      Java bindings 1.7.0
      See Also:
    • GetUTMZone

      public int GetUTMZone()
      Get UTM zone information.
      Returns:
      the UTM zone. As a positive value for the northern hemisphere and as a negative value for the southern hemisphere.
      Since:
      Java bindings 1.8.0
    • SetStatePlane

      public int SetStatePlane(int zone, int is_nad83, String unitsname, double units)
      Set State Plane projection definition.

      This will attempt to generate a complete definition of a state plane zone based on generating the entire SRS from the EPSG tables. If the EPSG tables are unavailable, it will produce a stubbed LOCAL_CS definition and return OGRERR_FAILURE.

      Parameters:
      zone - State plane zone number, in the USGS numbering scheme (as distinct from the Arc/Info and Erdas numbering scheme.
      is_nad83 - 1 if the NAD83 zone definition should be used or 0 if the NAD27 zone definition should be used.
      unitsname - Linear unit name to apply overriding the legal definition for this zone.
      units - Linear unit conversion factor to apply overriding the legal definition for this zone.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetStatePlane

      public int SetStatePlane(int zone, int is_nad83, String unitsname)
      Set State Plane projection definition.

      Same as below with units == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • SetStatePlane

      public int SetStatePlane(int zone, int is_nad83)
      Set State Plane projection definition.

      Same as below with unitsname == "" and units == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • SetStatePlane

      public int SetStatePlane(int zone)
      Set State Plane projection definition.

      Same as below with is_nad83 == 1, unitsname == "" and units == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • AutoIdentifyEPSG

      public int AutoIdentifyEPSG()
      Set EPSG authority info if possible.

      This method inspects a WKT definition, and adds EPSG authority nodes where an aspect of the coordinate system can be easily and safely corresponded with an EPSG identifier. In practice, this method will evolve over time. In theory it can add authority nodes for any object (i.e. spheroid, datum, GEOGCS, units, and PROJCS) that could have an authority node. Mostly this is useful to inserting appropriate PROJCS codes for common formulations (like UTM n WGS84).

      If it success the OGRSpatialReference is updated in place, and the method return 0. If the method fails to identify the general coordinate system, a RuntimeException() will be throwned

      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetProjection

      public int SetProjection(String name)
      Set a projection name.
      Parameters:
      name - the projection name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PT_TRANSVERSE_MERCATOR.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetProjParm

      public int SetProjParm(String name, double val)
      Set a projection parameter value.

      Adds a new PARAMETER under the PROJCS with the indicated name and value.

      Please check https://gdal.org/proj_list pages for legal parameter names for specific projections.

      Parameters:
      name - the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.
      val - value to assign.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • GetProjParm

      public double GetProjParm(String name, double default_val)
      Fetch a projection parameter value.

      NOTE: This code should be modified to translate non degree angles into degrees based on the GEOGCS unit. This has not yet been done.

      Parameters:
      name - the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.
      default_val - the value to return if this parameter doesn't exist.
      Returns:
      value of parameter.
    • GetProjParm

      public double GetProjParm(String name)
      Fetch a projection parameter value.

      Same as below with default_val == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • SetNormProjParm

      public int SetNormProjParm(String name, double val)
      Set a projection parameter with a normalized value.

      This method is the same as SetProjParm() except that the value of the parameter passed in is assumed to be in "normalized" form (decimal degrees for angular values, meters for linear values. The values are converted in a form suitable for the GEOGCS and linear units in effect.

      Parameters:
      name - the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.
      val - value to assign.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • GetNormProjParm

      public double GetNormProjParm(String name, double default_val)
      Fetch a normalized projection parameter value.

      This method is the same as GetProjParm() except that the value of the parameter is "normalized" into degrees or meters depending on whether it is linear or angular.

      Parameters:
      name - the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.
      default_val - the value to return if this parameter doesn't exist.
      Returns:
      value of parameter.
    • GetNormProjParm

      public double GetNormProjParm(String name)
      Fetch a normalized projection parameter value.

      Same as below with default_val == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • GetSemiMajor

      public double GetSemiMajor()
    • GetSemiMinor

      public double GetSemiMinor()
    • GetInvFlattening

      public double GetInvFlattening()
    • SetACEA

      public int SetACEA(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
    • SetAE

      public int SetAE(double clat, double clong, double fe, double fn)
    • SetBonne

      public int SetBonne(double stdp, double cm, double fe, double fn)
    • SetCEA

      public int SetCEA(double stdp1, double cm, double fe, double fn)
    • SetCS

      public int SetCS(double clat, double clong, double fe, double fn)
    • SetEC

      public int SetEC(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
    • SetEckertIV

      public int SetEckertIV(double cm, double fe, double fn)
    • SetEckertVI

      public int SetEckertVI(double cm, double fe, double fn)
    • SetEquirectangular

      public int SetEquirectangular(double clat, double clong, double fe, double fn)
    • SetEquirectangular2

      public int SetEquirectangular2(double clat, double clong, double pseudostdparallellat, double fe, double fn)
    • SetGaussSchreiberTMercator

      public int SetGaussSchreiberTMercator(double clat, double clong, double sc, double fe, double fn)
    • SetGS

      public int SetGS(double cm, double fe, double fn)
    • SetGH

      public int SetGH(double cm, double fe, double fn)
    • SetIGH

      public int SetIGH()
    • SetGEOS

      public int SetGEOS(double cm, double satelliteheight, double fe, double fn)
    • SetGnomonic

      public int SetGnomonic(double clat, double clong, double fe, double fn)
    • SetHOM

      public int SetHOM(double clat, double clong, double azimuth, double recttoskew, double scale, double fe, double fn)
    • SetHOM2PNO

      public int SetHOM2PNO(double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale, double fe, double fn)
    • SetKrovak

      public int SetKrovak(double clat, double clong, double azimuth, double pseudostdparallellat, double scale, double fe, double fn)
    • SetLAEA

      public int SetLAEA(double clat, double clong, double fe, double fn)
    • SetLCC

      public int SetLCC(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
    • SetLCC1SP

      public int SetLCC1SP(double clat, double clong, double scale, double fe, double fn)
    • SetLCCB

      public int SetLCCB(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
    • SetMC

      public int SetMC(double clat, double clong, double fe, double fn)
    • SetMercator

      public int SetMercator(double clat, double clong, double scale, double fe, double fn)
    • SetMercator2SP

      public int SetMercator2SP(double stdp1, double clat, double clong, double fe, double fn)
    • SetMollweide

      public int SetMollweide(double cm, double fe, double fn)
    • SetNZMG

      public int SetNZMG(double clat, double clong, double fe, double fn)
    • SetOS

      public int SetOS(double dfOriginLat, double dfCMeridian, double scale, double fe, double fn)
    • SetOrthographic

      public int SetOrthographic(double clat, double clong, double fe, double fn)
    • SetPolyconic

      public int SetPolyconic(double clat, double clong, double fe, double fn)
    • SetPS

      public int SetPS(double clat, double clong, double scale, double fe, double fn)
    • SetRobinson

      public int SetRobinson(double clong, double fe, double fn)
    • SetSinusoidal

      public int SetSinusoidal(double clong, double fe, double fn)
    • SetStereographic

      public int SetStereographic(double clat, double clong, double scale, double fe, double fn)
    • SetSOC

      public int SetSOC(double latitudeoforigin, double cm, double fe, double fn)
    • SetTM

      public int SetTM(double clat, double clong, double scale, double fe, double fn)
    • SetTMVariant

      public int SetTMVariant(String pszVariantName, double clat, double clong, double scale, double fe, double fn)
    • SetTMG

      public int SetTMG(double clat, double clong, double fe, double fn)
    • SetTMSO

      public int SetTMSO(double clat, double clong, double scale, double fe, double fn)
    • SetVDG

      public int SetVDG(double clong, double fe, double fn)
    • SetVerticalPerspective

      public int SetVerticalPerspective(double topoOriginLat, double topoOriginLon, double topoOriginHeight, double viewPointHeight, double fe, double fn)
    • SetWellKnownGeogCS

      public int SetWellKnownGeogCS(String name)
      Set a GeogCS based on well known name.

      This may be called on an empty OGRSpatialReference to make a geographic coordinate system, or on something with an existing PROJCS node to set the underlying geographic coordinate system of a projected coordinate system.

      The following well known text values are currently supported:

      • "WGS84": same as "EPSG:4326" but has no dependence on EPSG data files.
      • "WGS72": same as "EPSG:4322" but has no dependence on EPSG data files.
      • "NAD27": same as "EPSG:4267" but has no dependence on EPSG data files.
      • "NAD83": same as "EPSG:4269" but has no dependence on EPSG data files.
      • "EPSG:n": where n is the code a Geographic coordinate reference system.
      Parameters:
      name - name of well known geographic coordinate system.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetFromUserInput

      public int SetFromUserInput(String definition)
      Set spatial reference from various text formats.

      This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system. It may take the following forms:

      1. Well Known Text definition - passed on to importFromWkt().
      2. "EPSG:n" - number passed on to importFromEPSG().
      3. "EPSGA:n" - number passed on to importFromEPSGA().
      4. "AUTO:proj_id,unit_id,lon0,lat0" - WMS auto projections.
      5. "urn:ogc:def:crs:EPSG::n" - ogc urns
      6. PROJ.4 definitions - passed on to importFromProj4().
      7. filename - file read for WKT, XML or PROJ.4 definition.
      8. well known name accepted by SetWellKnownGeogCS(), such as NAD27, NAD83, WGS84 or WGS72.
      9. WKT (directly or in a file) in ESRI format should be prefixed with ESRI:: to trigger an automatic morphFromESRI().
      It is expected that this method will be extended in the future to support XML and perhaps a simplified "minilanguage" for indicating common UTM and State Plane definitions.

      This method is intended to be flexible, but by it's nature it is imprecise as it must guess information about the format intended. When possible applications should call the specific method appropriate if the input is known to be in a particular format.

      Parameters:
      definition - text definition to try to deduce SRS from.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • CopyGeogCSFrom

      public int CopyGeogCSFrom(SpatialReference src_srs)
      Copy GEOGCS from another OGRSpatialReference.

      The GEOGCS information is copied into this SpatialReference from another. If this object has a PROJCS root already, the GEOGCS is installed within it, otherwise it is installed as the root.

      Parameters:
      src_srs - the spatial reference to copy the GEOGCS information from.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetTOWGS84

      public int SetTOWGS84(double dfDX, double dfDY, double dfDZ, double dfEX, double dfEY, double dfEZ, double dfPPM)
      Set the Bursa-Wolf conversion to WGS84.

      This will create the TOWGS84 node as a child of the DATUM. It will fail if there is no existing DATUM node. Unlike most OGRSpatialReference methods it will insert itself in the appropriate order, and will replace an existing TOWGS84 node if there is one.

      The parameters have the same meaning as EPSG transformation 9606 (Position Vector 7-param. transformation).

      Parameters:
      dfDX - X child in meters.
      dfDY - Y child in meters.
      dfDZ - Z child in meters.
      dfEX - X rotation in arc seconds (optional, defaults to zero).
      dfEY - Y rotation in arc seconds (optional, defaults to zero).
      dfEZ - Z rotation in arc seconds (optional, defaults to zero).
      dfPPM - scaling factor (parts per million).
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • HasTOWGS84

      public boolean HasTOWGS84()
    • GetTOWGS84

      public int GetTOWGS84(double[] argout)
      Fetch TOWGS84 parameters, if available.
      Parameters:
      argout - allocated array of 7 doubles into which up to 7 coefficients are placed.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • AddGuessedTOWGS84

      public int AddGuessedTOWGS84()
    • SetLocalCS

      public int SetLocalCS(String name)
      Set the user visible LOCAL_CS name.

      This method is will ensure a LOCAL_CS node is created as the root, and set the provided name on it. It must be used before SetLinearUnits().

      Parameters:
      name - the user visible name to assign. Not used as a key.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetGeogCS

      public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits, double dfConvertToRadians)
      Set geographic coordinate system.

      This method is used to set the datum, ellipsoid, prime meridian and angular units for a geographic coordinate system. It can be used on it's own to establish a geographic spatial reference, or applied to a projected coordinate system to establish the underlying geographic coordinate system.

      Parameters:
      pszGeogName - user visible name for the geographic coordinate system (not to serve as a key).
      pszDatumName - key name for this datum. The OpenGIS specification lists some known values, and otherwise EPSG datum names with a standard transformation are considered legal keys.
      pszSpheroidName - user visible spheroid name (not to serve as a key)
      dfSemiMajor - the semi major axis of the spheroid.
      dfInvFlattening - the inverse flattening for the spheroid. This can be computed from the semi minor axis as 1/f = 1.0 / (1.0 - semiminor/semimajor).
      pszPMName - the name of the prime meridian (not to serve as a key) If this is null a default value of "Greenwich" will be used.
      dfPMOffset - the longitude of greenwich relative to this prime meridian.
      pszAngularUnits - the angular units name (see ogr_srs_api.h for some standard names). If null a value of "degrees" will be assumed.
      dfConvertToRadians - value to multiply angular units by to transform them to radians. A value of SRS_UL_DEGREE_CONV will be used if pszAngularUnits is null.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetGeogCS

      public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits)
      Set geographic coordinate system.

      Same as below with dfConvertToRadians = 0.0174532925199433

      Since:
      Java bindings 1.7.0
      See Also:
    • SetGeogCS

      public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset)
      Set geographic coordinate system.

      Same as below with pszAngularUnits = "degree" and dfConvertToRadians = 0.0174532925199433

      Since:
      Java bindings 1.7.0
      See Also:
    • SetGeogCS

      public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName)
      Set geographic coordinate system.

      Same as below with dfPMOffset = 0.0, pszAngularUnits = "degree" and dfConvertToRadians = 0.0174532925199433

      Since:
      Java bindings 1.7.0
      See Also:
    • SetGeogCS

      public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening)
      Set geographic coordinate system.

      Same as below with pszPMName = "Greenwich", dfPMOffset = 0.0, pszAngularUnits = "degree" and dfConvertToRadians = 0.0174532925199433

      Since:
      Java bindings 1.7.0
      See Also:
    • SetProjCS

      public int SetProjCS(String name)
      Set the user visible PROJCS name.

      This method is will ensure a PROJCS node is created as the root, and set the provided name on it. If used on a GEOGCS coordinate system, the GEOGCS node will be demoted to be a child of the new PROJCS root.

      Parameters:
      name - the user visible name to assign. May be null
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • SetProjCS

      public int SetProjCS()
      Set the user visible PROJCS name.

      Same as below with name == null

      See Also:
    • SetGeocCS

      public int SetGeocCS(String name)
      Set the user visible GEOCCS name.

      This method is will ensure a GEOCCS node is created as the root, and set the provided name on it. If used on a GEOGCS coordinate system, the DATUM and PRIMEM nodes from the GEOGCS will be transferred over to the GEOGCS.

      Parameters:
      name - the user visible name to assign. Not used as a key. May be null
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
      Since:
      OGR 1.9.0
    • SetGeocCS

      public int SetGeocCS()
      Set the user visible GEOCCS name.

      Same as below with name == null

      Since:
      OGR 1.9.0
      See Also:
    • SetVertCS

      public int SetVertCS(String VertCSName, String VertDatumName, int VertDatumType)
      Set the user visible VERT_CS name.

      This method is will ensure a VERT_CS node is created if needed. If the existing coordinate system is GEOGCS or PROJCS rooted, then it will be turned into a COMPD_CS.

      Parameters:
      VertCSName - the user visible name of the vertical coordinate system. Not used as a key.
      VertDatumName - the user visible name of the vertical datum. It is helpful if this matches the EPSG name.
      VertDatumType - the OGC vertical datum type, usually 2005.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
      Since:
      OGR 1.9.0
    • SetVertCS

      public int SetVertCS(String VertCSName, String VertDatumName)
    • SetVertCS

      public int SetVertCS(String VertCSName)
    • SetVertCS

      public int SetVertCS()
    • SetCompoundCS

      public int SetCompoundCS(String name, SpatialReference horizcs, SpatialReference vertcs)
    • ImportFromWkt

      public int ImportFromWkt(String wkt)
      Import from WKT string.

      This method will wipe the existing SRS definition, and reassign it based on the contents of the passed WKT string. Only as much of the input string as needed to construct this SRS is consumed from the input string.

      Parameters:
      wkt - WKT string
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromProj4

      public int ImportFromProj4(String proj4)
      Import PROJ.4 coordinate string.

      The OGRSpatialReference is initialized from the passed PROJ.4 style coordinate system string. In addition to many +proj formulations which have OGC equivalents, it is also possible to import "+init=epsg:n" style definitions. These are passed to importFromEPSG(). Other init strings (such as the state plane zones) are not currently supported.

       Example:
         pszProj4 = "+proj=utm +zone=11 +datum=WGS84"
       

      Some parameters, such as grids, recognized by PROJ.4 may not be well understood and translated into the OGRSpatialReference model. It is possible to add the +wktext parameter which is a special keyword that OGR recognizes as meaning "embed the entire PROJ.4 string in the WKT and use it literally when converting back to PROJ.4 format".

       For example:
       "+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl
        +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"
      

      will be translated as :

       PROJCS["unnamed",
          GEOGCS["International 1909 (Hayford)",
              DATUM["unknown",
                  SPHEROID["intl",6378388,297]],
              PRIMEM["Greenwich",0],
              UNIT["degree",0.0174532925199433]],
          PROJECTION["New_Zealand_Map_Grid"],
          PARAMETER["latitude_of_origin",-41],
          PARAMETER["central_meridian",173],
          PARAMETER["false_easting",2510000],
          PARAMETER["false_northing",6023150],
          UNIT["Meter",1],
          EXTENSION["PROJ4","+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000
                     +y_0=6023150 +ellps=intl  +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"]]
       
      Parameters:
      proj4 - the PROJ.4 style string.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromUrl

      public int ImportFromUrl(String url)
      Set spatial reference from a URL.

      This method will download the spatial reference at a given URL and feed it into SetFromUserInput for you.

      Parameters:
      url - text definition to try to deduce SRS from.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromESRI

      public int ImportFromESRI(Vector ppszInput)
      Import coordinate system from ESRI .prj format(s).

      This function will read the text loaded from an ESRI .prj file, and translate it into an OGRSpatialReference definition. This should support many (but by no means all) old style (Arc/Info 7.x) .prj files, as well as the newer pseudo-OGC WKT .prj files. Note that new style .prj files are in OGC WKT format, but require some manipulation to correct datum names, and units on some projection parameters. This is addressed within importFromESRI() by an automatic call to morphFromESRI().

      Currently only GEOGRAPHIC, UTM, STATEPLANE, GREATBRITIAN_GRID, ALBERS, EQUIDISTANT_CONIC, and TRANSVERSE (mercator) projections are supported from old style files.

      At this time there is no equivalent exportToESRI() method. Writing old style .prj files is not supported by OGRSpatialReference. However the morphToESRI() and exportToWkt() methods can be used to generate output suitable to write to new style (Arc 8) .prj files.

      Parameters:
      ppszInput - vector of strings containing the definition.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromEPSG

      public int ImportFromEPSG(int nCode)
      Initialize SRS based on EPSG GCS or PCS code.

      This method will initialize the spatial reference based on the passed in EPSG GCS or PCS code. The coordinate system definitions are normally read from the EPSG derived support files such as pcs.csv, gcs.csv, pcs.override.csv, gcs.override.csv and falling back to search for a PROJ.4 epsg init file or a definition in epsg.wkt.

      These support files are normally searched for in /usr/local/share/gdal or in the directory identified by the GDAL_DATA configuration option. See CPLFindFile() for details.

      This method is relatively expensive, and generally involves quite a bit of text file scanning. Reasonable efforts should be made to avoid calling it many times for the same coordinate system.

      This method is similar to importFromEPSGA() except that EPSG preferred axis ordering will *not* be applied for geographic coordinate systems. EPSG normally defines geographic coordinate systems to use lat/long contrary to typical GIS use).

      Parameters:
      nCode - a GCS or PCS code from the horizontal coordinate system table.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromEPSGA

      public int ImportFromEPSGA(int arg)
    • ImportFromPCI

      public int ImportFromPCI(String proj, String units, double[] prjParams)
      Import coordinate system from PCI projection definition.

      PCI software uses 16-character string to specify coordinate system and datum/ellipsoid. You should supply at least this string to the importFromPCI() function.

      Parameters:
      proj - string containing the definition. Looks like "pppppppppppp Ennn" or "pppppppppppp Dnnn", where "pppppppppppp" is a projection code, "Ennn" is an ellipsoid code, "Dnnn" --- a datum code.
      units - Grid units code ("DEGREE" or "METRE"). If null, "METRE" will be used.
      prjParams - Array of 17 coordinate system parameters:
       [0]  Spheroid semi major axis
       [1]  Spheroid semi minor axis
       [2]  Reference Longitude
       [3]  Reference Latitude
       [4]  First Standard Parallel
       [5]  Second Standard Parallel
       [6]  False Easting
       [7]  False Northing
       [8]  Scale Factor
       [9]  Height above sphere surface
       [10] Longitude of 1st point on center line
       [11] Latitude of 1st point on center line
       [12] Longitude of 2nd point on center line
       [13] Latitude of 2nd point on center line
       [14] Azimuth east of north for center line
       [15] Landsat satellite number
       [16] Landsat path number
       
      Particular projection uses different parameters, unused ones may be set to zero. If null supplied instead of array pointer default values will be used (i.e., zeroes).
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromPCI

      public int ImportFromPCI(String proj, String units)
      Import coordinate system from PCI projection definition.

      Same as below with prjParams == null

      Since:
      Java bindings 1.7.0
      See Also:
    • ImportFromPCI

      public int ImportFromPCI(String proj)
      Import coordinate system from PCI projection definition.

      Same as below with units == null and prjParams == null

      Since:
      Java bindings 1.7.0
      See Also:
    • ImportFromUSGS

      public int ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams, int iDatum)
      Import coordinate system from USGS projection definition.

      This method will import projection definition in style, used by USGS GCTP software. GCTP operates on angles in packed DMS format (see CPLDecToPackedDMS() function for details), so all angle values (latitudes, longitudes, azimuths, etc.) specified in the padfPrjParams array should be in the packed DMS format. Projection Transformation Package Projection Parameters:

       ----------------------------------------------------------------------------
                               |                    Array Element
        Code & Projection Id   |---------------------------------------------------
                               |   0  |   1  |  2   |  3   |   4   |    5    |6 | 7
       ----------------------------------------------------------------------------
        0 Geographic           |      |      |      |      |       |         |  |
        1 U T M                |Lon/Z |Lat/Z |      |      |       |         |  |
        2 State Plane          |      |      |      |      |       |         |  |
        3 Albers Equal Area    |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
        4 Lambert Conformal C  |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
        5 Mercator             |SMajor|SMinor|      |      |CentMer|TrueScale|FE|FN
        6 Polar Stereographic  |SMajor|SMinor|      |      |LongPol|TrueScale|FE|FN
        7 Polyconic            |SMajor|SMinor|      |      |CentMer|OriginLat|FE|FN
        8 Equid. Conic A       |SMajor|SMinor|STDPAR|      |CentMer|OriginLat|FE|FN
          Equid. Conic B       |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
        9 Transverse Mercator  |SMajor|SMinor|Factor|      |CentMer|OriginLat|FE|FN
       10 Stereographic        |Sphere|      |      |      |CentLon|CenterLat|FE|FN
       11 Lambert Azimuthal    |Sphere|      |      |      |CentLon|CenterLat|FE|FN
       12 Azimuthal            |Sphere|      |      |      |CentLon|CenterLat|FE|FN
       13 Gnomonic             |Sphere|      |      |      |CentLon|CenterLat|FE|FN
       14 Orthographic         |Sphere|      |      |      |CentLon|CenterLat|FE|FN
       15 Gen. Vert. Near Per  |Sphere|      |Height|      |CentLon|CenterLat|FE|FN
       16 Sinusoidal           |Sphere|      |      |      |CentMer|         |FE|FN
       17 Equirectangular      |Sphere|      |      |      |CentMer|TrueScale|FE|FN
       18 Miller Cylindrical   |Sphere|      |      |      |CentMer|         |FE|FN
       19 Van der Grinten      |Sphere|      |      |      |CentMer|OriginLat|FE|FN
       20 Hotin Oblique Merc A |SMajor|SMinor|Factor|      |       |OriginLat|FE|FN
          Hotin Oblique Merc B |SMajor|SMinor|Factor|AziAng|AzmthPt|OriginLat|FE|FN
       21 Robinson             |Sphere|      |      |      |CentMer|         |FE|FN
       22 Space Oblique Merc A |SMajor|SMinor|      |IncAng|AscLong|         |FE|FN
          Space Oblique Merc B |SMajor|SMinor|Satnum|Path  |       |         |FE|FN
       23 Alaska Conformal     |SMajor|SMinor|      |      |       |         |FE|FN
       24 Interrupted Goode    |Sphere|      |      |      |       |         |  |
       25 Mollweide            |Sphere|      |      |      |CentMer|         |FE|FN
       26 Interrupt Mollweide  |Sphere|      |      |      |       |         |  |
       27 Hammer               |Sphere|      |      |      |CentMer|         |FE|FN
       28 Wagner IV            |Sphere|      |      |      |CentMer|         |FE|FN
       29 Wagner VII           |Sphere|      |      |      |CentMer|         |FE|FN
       30 Oblated Equal Area   |Sphere|      |Shapem|Shapen|CentLon|CenterLat|FE|FN
       ----------------------------------------------------------------------------
      
             ----------------------------------------------------
                                     |      Array Element       |
               Code & Projection Id  |---------------------------
                                     |  8  |  9 |  10 | 11 | 12 |
             ----------------------------------------------------
              0 Geographic           |     |    |     |    |    |
              1 U T M                |     |    |     |    |    |
              2 State Plane          |     |    |     |    |    |
              3 Albers Equal Area    |     |    |     |    |    |
              4 Lambert Conformal C  |     |    |     |    |    |
              5 Mercator             |     |    |     |    |    |
              6 Polar Stereographic  |     |    |     |    |    |
              7 Polyconic            |     |    |     |    |    |
              8 Equid. Conic A       |zero |    |     |    |    |
                Equid. Conic B       |one  |    |     |    |    |
              9 Transverse Mercator  |     |    |     |    |    |
             10 Stereographic        |     |    |     |    |    |
             11 Lambert Azimuthal    |     |    |     |    |    |
             12 Azimuthal            |     |    |     |    |    |
             13 Gnomonic             |     |    |     |    |    |
             14 Orthographic         |     |    |     |    |    |
             15 Gen. Vert. Near Per  |     |    |     |    |    |
             16 Sinusoidal           |     |    |     |    |    |
             17 Equirectangular      |     |    |     |    |    |
             18 Miller Cylindrical   |     |    |     |    |    |
             19 Van der Grinten      |     |    |     |    |    |
             20 Hotin Oblique Merc A |Long1|Lat1|Long2|Lat2|zero|
                Hotin Oblique Merc B |     |    |     |    |one |
             21 Robinson             |     |    |     |    |    |
             22 Space Oblique Merc A |PSRev|LRat|PFlag|    |zero|
                Space Oblique Merc B |     |    |     |    |one |
             23 Alaska Conformal     |     |    |     |    |    |
             24 Interrupted Goode    |     |    |     |    |    |
             25 Mollweide            |     |    |     |    |    |
             26 Interrupt Mollweide  |     |    |     |    |    |
             27 Hammer               |     |    |     |    |    |
             28 Wagner IV            |     |    |     |    |    |
             29 Wagner VII           |     |    |     |    |    |
             30 Oblated Equal Area   |Angle|    |     |    |    |
             ----------------------------------------------------
      
         where
      
          Lon/Z     Longitude of any point in the UTM zone or zero.  If zero,
                    a zone code must be specified.
          Lat/Z     Latitude of any point in the UTM zone or zero.  If zero, a
                    zone code must be specified.
          SMajor    Semi-major axis of ellipsoid.  If zero, Clarke 1866 in meters
                    is assumed.
          SMinor    Eccentricity squared of the ellipsoid if less than zero,
                    if zero, a spherical form is assumed, or if greater than
                    zero, the semi-minor axis of ellipsoid.
          Sphere    Radius of reference sphere.  If zero, 6370997 meters is used.
          STDPAR    Latitude of the standard parallel
          STDPR1    Latitude of the first standard parallel
          STDPR2    Latitude of the second standard parallel
          CentMer   Longitude of the central meridian
          OriginLat Latitude of the projection origin
          FE        False easting in the same units as the semi-major axis
          FN        False northing in the same units as the semi-major axis
          TrueScale Latitude of true scale
          LongPol   Longitude down below pole of map
          Factor    Scale factor at central meridian (Transverse Mercator) or
                    center of projection (Hotine Oblique Mercator)
          CentLon   Longitude of center of projection
          CenterLat Latitude of center of projection
          Height    Height of perspective point
          Long1     Longitude of first point on center line (Hotine Oblique
                    Mercator, format A)
          Long2     Longitude of second point on center line (Hotine Oblique
                    Mercator, format A)
          Lat1      Latitude of first point on center line (Hotine Oblique
                    Mercator, format A)
          Lat2      Latitude of second point on center line (Hotine Oblique
                    Mercator, format A)
          AziAng    Azimuth angle east of north of center line (Hotine Oblique
                    Mercator, format B)
          AzmthPt   Longitude of point on central meridian where azimuth occurs
                    (Hotine Oblique Mercator, format B)
          IncAng    Inclination of orbit at ascending node, counter-clockwise
                    from equator (SOM, format A)
          AscLong   Longitude of ascending orbit at equator (SOM, format A)
          PSRev     Period of satellite revolution in minutes (SOM, format A)
          LRat      Landsat ratio to compensate for confusion at northern end
                    of orbit (SOM, format A -- use 0.5201613)
          PFlag     End of path flag for Landsat:  0 = start of path,
                    1 = end of path (SOM, format A)
          Satnum    Landsat Satellite Number (SOM, format B)
          Path      Landsat Path Number (Use WRS-1 for Landsat 1, 2 and 3 and
                    WRS-2 for Landsat 4, 5 and 6.)  (SOM, format B)
          Shapem    Oblated Equal Area oval shape parameter m
          Shapen    Oblated Equal Area oval shape parameter n
          Angle     Oblated Equal Area oval rotation angle
      
       Array elements 13 and 14 are set to zero. All array elements with blank
       fields are set to zero too.
       
      If the datum code is negative, the first two values in the parameter array (param) are used to define the values as follows:
      • If padfPrjParams[0] is a non-zero value and padfPrjParams[1] is greater than one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is set to padfPrjParams[1].
      • If padfPrjParams[0] is nonzero and padfPrjParams[1] is greater than zero but less than or equal to one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is computed from the eccentricity squared value padfPrjParams[1]:

        semiminor = sqrt(1.0 - ES) * semimajor

        where

        ES = eccentricity squared

      • If padfPrjParams[0] is nonzero and padfPrjParams[1] is equal to zero, the semimajor axis and semiminor axis are set to padfPrjParams[0].
      • If padfPrjParams[0] equals zero and padfPrjParams[1] is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis and semiminor axis.
      • If padfPrjParams[0] and padfPrjParams[1] equals zero, the semimajor axis is set to 6370997.0 and the semiminor axis is set to zero.
      If a datum code is zero or greater, the semimajor and semiminor axis are defined by the datum code as found in the following table: Supported Datums:
             0: Clarke 1866 (default)
             1: Clarke 1880
             2: Bessel
             3: International 1967
             4: International 1909
             5: WGS 72
             6: Everest
             7: WGS 66
             8: GRS 1980/WGS 84
             9: Airy
            10: Modified Everest
            11: Modified Airy
            12: Walbeck
            13: Southeast Asia
            14: Australian National
            15: Krassovsky
            16: Hough
            17: Mercury 1960
            18: Modified Mercury 1968
            19: Sphere of Radius 6370997 meters
       
      Parameters:
      iProjSys - Input projection system code, used in GCTP.
      iZone - Input zone for UTM and State Plane projection systems. For Southern Hemisphere UTM use a negative zone code. iZone ignored for all other projections.
      padfPrjParams - Array of 15 coordinate system parameters. These parameters differs for different projections.
      iDatum - Input spheroid.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromUSGS

      public int ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams)
      Import coordinate system from USGS projection definition.

      Same as below with iDatum == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • ImportFromUSGS

      public int ImportFromUSGS(int iProjSys, int iZone)
      Import coordinate system from USGS projection definition.

      Same as below with padfPrjParams == null and iDatum == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • ImportFromUSGS

      public int ImportFromUSGS(int iProjSys)
      Import coordinate system from USGS projection definition.

      Same as below with iZone == 0, padfPrjParams == null and iDatum == 0

      Since:
      Java bindings 1.7.0
      See Also:
    • ImportFromXML

      public int ImportFromXML(String xmlString)
      Import coordinate system from XML format (GML only currently).
      Parameters:
      xmlString - XML string to import
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromERM

      public int ImportFromERM(String proj, String datum, String units)
    • ImportFromMICoordSys

      public int ImportFromMICoordSys(String coord_sys)
      Import Mapinfo style CoordSys definition.

      The SpatialReference is initialized from the passed Mapinfo style CoordSys definition string.

      Parameters:
      coord_sys - Mapinfo style CoordSys definition string.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ImportFromOzi

      public int ImportFromOzi(Vector papszLines)
    • ExportToWkt

      public int ExportToWkt(String[] argout, Vector options)
    • ExportToWkt

      public int ExportToWkt(String[] argout)
      Convert this SRS into WKT format.
      Parameters:
      argout - an already allocated array of 1 string to receive the output
      Returns:
      0.
    • ExportToPrettyWkt

      public int ExportToPrettyWkt(String[] argout, int simplify)
      Convert this SRS into a nicely formatted WKT string for display to a person.
      Parameters:
      argout - an already allocated array of 1 string to receive the output
      simplify - 1 if the AXIS, AUTHORITY and EXTENSION nodes should be stripped off
      Returns:
      0.
    • ExportToPrettyWkt

      public int ExportToPrettyWkt(String[] argout)
      Convert this SRS into a nicely formatted WKT string for display to a person.

      Same as below with simplify == 0.

      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToPROJJSON

      public int ExportToPROJJSON(String[] argout, Vector options)
    • ExportToPROJJSON

      public int ExportToPROJJSON(String[] argout)
    • ExportToProj4

      public int ExportToProj4(String[] argout)
      Export coordinate system in PROJ.4 format.

      Converts the loaded coordinate reference system into PROJ.4 format to the extent possible.

      LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with 0.

      Parameters:
      argout - an already allocated array of 1 string to receive the PROJ.4 definition
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ExportToPCI

      public int ExportToPCI(String[] proj, String[] units, double[] params)
      Export coordinate system in PCI projection definition.

      Converts the loaded coordinate reference system into PCI projection definition to the extent possible.

      LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with 0.

      Parameters:
      proj - an already allocated array of 1 string to receive the PCI projection definition
      units - an already allocated array of 1 string to receive units definition
      params - an already allocated array of 17 doubles to receive the 17 projection parameters will be assigned. See importFromPCI() for the list of parameters.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ExportToUSGS

      public int ExportToUSGS(int[] projsys, int[] zone, double[] params, int[] datum)
      Export coordinate system in USGS GCTP projection definition.
      Parameters:
      projsys - an already allocated array of 1 integer to receive the projection system code.
      zone - an already allocated array of 1 integer to receive the zone for UTM and State Plane projection.
      params - n already allocated array of 15 doubles to receive 15 projection parameters. See importFromUSGS() for the list of parameters.
      datum - an already allocated array of 1 integer to receive the datum code.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ExportToERM

      public int ExportToERM(String[] proj, String[] datum, String[] units)
    • ExportToXML

      public int ExportToXML(String[] argout, String dialect)
      Export coordinate system in XML format.

      Converts the loaded coordinate reference system into XML format to the extent possible.

      LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with 0.

      Parameters:
      argout - an already allocated array of 1 string to receive the XML definition.
      dialect - currently ignored. The dialect used is GML based.
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ExportToXML

      public int ExportToXML(String[] argout)
      Export coordinate system in XML format.
      Since:
      Java bindings 1.7.0
      See Also:
    • ExportToMICoordSys

      public int ExportToMICoordSys(String[] argout)
      Export coordinate system in Mapinfo style CoordSys format.
      Parameters:
      argout - an already allocated array of 1 string to receive the output
      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • CloneGeogCS

      public SpatialReference CloneGeogCS()
      Make a duplicate of the GEOGCS node of this SpatialReference object.
      Returns:
      a new SRS, which becomes the responsibility of the caller.
    • Clone

      public SpatialReference Clone()
      Make a duplicate of this SpatialReference object.
      Returns:
      a new SRS, which becomes the responsibility of the caller.
    • StripVertical

      public int StripVertical()
    • Validate

      public int Validate()
      Validate SRS tokens.

      This method attempts to verify that the spatial reference system is well formed, and consists of known tokens. The validation is not comprehensive.

      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • MorphToESRI

      public int MorphToESRI()
      Convert in place to ESRI WKT format.

      The value nodes of this coordinate system are modified in various manners more closely map onto the ESRI concept of WKT format. This includes renaming a variety of projections and arguments, and stripping out nodes note recognised by ESRI (like AUTHORITY and AXIS).

      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • MorphFromESRI

      public int MorphFromESRI()
      Convert in place from ESRI WKT format.

      The value notes of this coordinate system are modified in various manners to adhere more closely to the WKT standard. This mostly involves translating a variety of ESRI names for projections, arguments and datums to "standard" names, as defined by Adam Gawne-Cain's reference translation of EPSG to WKT for the CT specification.

      Returns:
      0 on success. Otherwise throws a RuntimeException() (or an error code if DontUseExceptions() has been called).
    • ConvertToOtherProjection

      public SpatialReference ConvertToOtherProjection(String other_projection, Vector options)
    • ConvertToOtherProjection

      public SpatialReference ConvertToOtherProjection(String other_projection)
    • PromoteTo3D

      public int PromoteTo3D(String name)
    • PromoteTo3D

      public int PromoteTo3D()
    • DemoteTo2D

      public int DemoteTo2D(String name)
    • DemoteTo2D

      public int DemoteTo2D()