text:
# Julia wrapper for header: /usr/local/include/ogr_srs_api.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0

"""
    OSRAxisEnumToName(OGRAxisOrientation eOrientation) -> const char *

Return the string representation for the OGRAxisOrientation enumeration.

### Returns
an internal string
"""
function OSRAxisEnumToName(eOrientation::OGRAxisOrientation)
    ccall((:OSRAxisEnumToName, libgdal), Cstring, (OGRAxisOrientation,), eOrientation)
end

"""
    OSRNewSpatialReference(const char * pszWKT) -> OGRSpatialReferenceH

Constructor.
"""
function OSRNewSpatialReference(arg1)
    ccall((:OSRNewSpatialReference, libgdal), OGRSpatialReferenceH, (Cstring,), arg1)
end

"""
    OSRCloneGeogCS(OGRSpatialReferenceH hSource) -> OGRSpatialReferenceH

Make a duplicate of the GEOGCS node of this OGRSpatialReference object.
"""
function OSRCloneGeogCS(arg1::OGRSpatialReferenceH)
    ccall((:OSRCloneGeogCS, libgdal), OGRSpatialReferenceH, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRClone(OGRSpatialReferenceH hSRS) -> OGRSpatialReferenceH

Make a duplicate of this OGRSpatialReference.
"""
function OSRClone(arg1::OGRSpatialReferenceH)
    ccall((:OSRClone, libgdal), OGRSpatialReferenceH, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRDestroySpatialReference(OGRSpatialReferenceH hSRS) -> void

OGRSpatialReference destructor.

### Parameters
* **hSRS**: the object to delete
"""
function OSRDestroySpatialReference(arg1::OGRSpatialReferenceH)
    ccall((:OSRDestroySpatialReference, libgdal), Void, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRReference(OGRSpatialReferenceH hSRS) -> int

Increments the reference count by one.
"""
function OSRReference(arg1::OGRSpatialReferenceH)
    ccall((:OSRReference, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRDereference(OGRSpatialReferenceH hSRS) -> int

Decrements the reference count by one.
"""
function OSRDereference(arg1::OGRSpatialReferenceH)
    ccall((:OSRDereference, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRRelease(OGRSpatialReferenceH hSRS) -> void

Decrements the reference count by one, and destroy if zero.
"""
function OSRRelease(arg1::OGRSpatialReferenceH)
    ccall((:OSRRelease, libgdal), Void, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRValidate(OGRSpatialReferenceH) -> OGRErr

Validate SRS tokens.
"""
function OSRValidate(arg1::OGRSpatialReferenceH)
    ccall((:OSRValidate, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRFixupOrdering(OGRSpatialReferenceH hSRS) -> OGRErr

Correct parameter ordering to match CT Specification.
"""
function OSRFixupOrdering(arg1::OGRSpatialReferenceH)
    ccall((:OSRFixupOrdering, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRFixup(OGRSpatialReferenceH hSRS) -> OGRErr

Fixup as needed.
"""
function OSRFixup(arg1::OGRSpatialReferenceH)
    ccall((:OSRFixup, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRStripCTParms(OGRSpatialReferenceH hSRS) -> OGRErr

Strip OGC CT Parameters.
"""
function OSRStripCTParms(arg1::OGRSpatialReferenceH)
    ccall((:OSRStripCTParms, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRImportFromEPSG(OGRSpatialReferenceH hSRS,
                      int nCode) -> OGRErr

Initialize SRS based on EPSG GCS or PCS code.
"""
function OSRImportFromEPSG(arg1::OGRSpatialReferenceH, arg2::Cint)
    ccall((:OSRImportFromEPSG, libgdal), OGRErr, (OGRSpatialReferenceH, Cint), arg1, arg2)
end

"""
    OSRImportFromEPSGA(OGRSpatialReferenceH hSRS,
                       int nCode) -> OGRErr

Initialize SRS based on EPSG GCS or PCS code.
"""
function OSRImportFromEPSGA(arg1::OGRSpatialReferenceH, arg2::Cint)
    ccall((:OSRImportFromEPSGA, libgdal), OGRErr, (OGRSpatialReferenceH, Cint), arg1, arg2)
end

"""
    OSRImportFromWkt(OGRSpatialReferenceH hSRS,
                     char ** ppszInput) -> OGRErr

Import from WKT string.
"""
function OSRImportFromWkt(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromWkt, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromProj4(OGRSpatialReferenceH,
                       const char *) -> OGRErr

Import PROJ.4 coordinate string.
"""
function OSRImportFromProj4(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromProj4, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), arg1, arg2)
end

"""
    OSRImportFromESRI(OGRSpatialReferenceH,
                      char **) -> OGRErr

Import coordinate system from ESRI .prj format(s).
"""
function OSRImportFromESRI(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromESRI, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromPCI(OGRSpatialReferenceH hSRS,
                     const char *,
                     const char *,
                     double *) -> OGRErr

Import coordinate system from PCI projection definition.
"""
function OSRImportFromPCI(hSRS::OGRSpatialReferenceH, arg1, arg2, arg3)
    ccall((:OSRImportFromPCI, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Ptr{Cdouble}), hSRS, arg1, arg2, arg3)
end

"""
    OSRImportFromUSGS(OGRSpatialReferenceH,
                      long,
                      long,
                      double *,
                      long) -> OGRErr

Import coordinate system from USGS projection definition.
"""
function OSRImportFromUSGS(arg1::OGRSpatialReferenceH, arg2::Clong, arg3::Clong, arg4, arg5::Clong)
    ccall((:OSRImportFromUSGS, libgdal), OGRErr, (OGRSpatialReferenceH, Clong, Clong, Ptr{Cdouble}, Clong), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRImportFromXML(OGRSpatialReferenceH,
                     const char *) -> OGRErr

Import coordinate system from XML format (GML only currently).
"""
function OSRImportFromXML(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromXML, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), arg1, arg2)
end

"""
    OSRImportFromDict(OGRSpatialReferenceH,
                      const char *,
                      const char *) -> OGRErr

Read SRS from WKT dictionary.

### Parameters
* **hSRS**: spatial reference system handle.
* **pszDictFile**: the name of the dictionary file to load.
* **pszCode**: the code to lookup in the dictionary.

### Returns
OGRERR_NONE on success, or OGRERR_SRS_UNSUPPORTED if the code isn't found, and OGRERR_SRS_FAILURE if something more dramatic goes wrong.
"""
function OSRImportFromDict(arg1::OGRSpatialReferenceH, arg2, arg3)
    ccall((:OSRImportFromDict, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring), arg1, arg2, arg3)
end

"""
    OSRImportFromPanorama(OGRSpatialReferenceH,
                          long,
                          long,
                          long,
                          double *) -> OGRErr

Import coordinate system from "Panorama" GIS projection definition.
"""
function OSRImportFromPanorama(arg1::OGRSpatialReferenceH, arg2::Clong, arg3::Clong, arg4::Clong, arg5)
    ccall((:OSRImportFromPanorama, libgdal), OGRErr, (OGRSpatialReferenceH, Clong, Clong, Clong, Ptr{Cdouble}), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRImportFromOzi(OGRSpatialReferenceH,
                     const char *const *) -> OGRErr

Import coordinate system from OziExplorer projection definition.

### Parameters
* **hSRS**: spatial reference object.
* **papszLines**: Map file lines. This is an array of strings containing the whole OziExplorer .MAP file. The array is terminated by a NULL pointer.

### Returns
OGRERR_NONE on success or an error code in case of failure.
"""
function OSRImportFromOzi(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromOzi, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRImportFromMICoordSys(OGRSpatialReferenceH hSRS,
                            const char * pszCoordSys) -> OGRErr

Import Mapinfo style CoordSys definition.
"""
function OSRImportFromMICoordSys(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromMICoordSys, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), arg1, arg2)
end

"""
    OSRImportFromERM(OGRSpatialReferenceH,
                     const char *,
                     const char *,
                     const char *) -> OGRErr

Create OGR WKT from ERMapper projection definitions.
"""
function OSRImportFromERM(arg1::OGRSpatialReferenceH, arg2, arg3, arg4)
    ccall((:OSRImportFromERM, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cstring), arg1, arg2, arg3, arg4)
end

"""
    OSRImportFromUrl(OGRSpatialReferenceH hSRS,
                     const char * pszUrl) -> OGRErr

Set spatial reference from a URL.
"""
function OSRImportFromUrl(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRImportFromUrl, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), arg1, arg2)
end

"""
    OSRExportToWkt(OGRSpatialReferenceH hSRS,
                   char ** ppszReturn) -> OGRErr

Convert this SRS into WKT format.
"""
function OSRExportToWkt(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRExportToWkt, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToPrettyWkt(OGRSpatialReferenceH hSRS,
                         char ** ppszReturn,
                         int bSimplify) -> OGRErr

Convert this SRS into a nicely formatted WKT string for display to a person.
"""
function OSRExportToPrettyWkt(arg1::OGRSpatialReferenceH, arg2, arg3::Cint)
    ccall((:OSRExportToPrettyWkt, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}, Cint), arg1, arg2, arg3)
end

"""
    OSRExportToProj4(OGRSpatialReferenceH,
                     char **) -> OGRErr

Export coordinate system in PROJ.4 format.
"""
function OSRExportToProj4(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRExportToProj4, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToPCI(OGRSpatialReferenceH,
                   char **,
                   char **,
                   double **) -> OGRErr

Export coordinate system in PCI projection definition.
"""
function OSRExportToPCI(arg1::OGRSpatialReferenceH, arg2, arg3, arg4)
    ccall((:OSRExportToPCI, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}, Ptr{Cstring}, Ptr{Ptr{Cdouble}}), arg1, arg2, arg3, arg4)
end

"""
    OSRExportToUSGS(OGRSpatialReferenceH,
                    long *,
                    long *,
                    double **,
                    long *) -> OGRErr

Export coordinate system in USGS GCTP projection definition.
"""
function OSRExportToUSGS(arg1::OGRSpatialReferenceH, arg2, arg3, arg4, arg5)
    ccall((:OSRExportToUSGS, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Clong}, Ptr{Clong}, Ptr{Ptr{Cdouble}}, Ptr{Clong}), arg1, arg2, arg3, arg4, arg5)
end

"""
    OSRExportToXML(OGRSpatialReferenceH,
                   char **,
                   const char *) -> OGRErr

Export coordinate system in XML format.
"""
function OSRExportToXML(arg1::OGRSpatialReferenceH, arg2, arg3)
    ccall((:OSRExportToXML, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}, Cstring), arg1, arg2, arg3)
end

"""
    OSRExportToPanorama(OGRSpatialReferenceH,
                        long *,
                        long *,
                        long *,
                        long *,
                        double *) -> OGRErr

Export coordinate system in "Panorama" GIS projection definition.
"""
function OSRExportToPanorama(arg1::OGRSpatialReferenceH, arg2, arg3, arg4, arg5, arg6)
    ccall((:OSRExportToPanorama, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Clong}, Ptr{Clong}, Ptr{Clong}, Ptr{Clong}, Ptr{Cdouble}), arg1, arg2, arg3, arg4, arg5, arg6)
end

"""
    OSRExportToMICoordSys(OGRSpatialReferenceH hSRS,
                          char ** ppszReturn) -> OGRErr

Export coordinate system in Mapinfo style CoordSys format.
"""
function OSRExportToMICoordSys(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRExportToMICoordSys, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRExportToERM(OGRSpatialReferenceH,
                   char *,
                   char *,
                   char *) -> OGRErr

Convert coordinate system to ERMapper format.
"""
function OSRExportToERM(arg1::OGRSpatialReferenceH, arg2, arg3, arg4)
    ccall((:OSRExportToERM, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cstring), arg1, arg2, arg3, arg4)
end

"""
    OSRMorphToESRI(OGRSpatialReferenceH) -> OGRErr

Convert in place to ESRI WKT format.
"""
function OSRMorphToESRI(arg1::OGRSpatialReferenceH)
    ccall((:OSRMorphToESRI, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRMorphFromESRI(OGRSpatialReferenceH) -> OGRErr

Convert in place from ESRI WKT format.
"""
function OSRMorphFromESRI(arg1::OGRSpatialReferenceH)
    ccall((:OSRMorphFromESRI, libgdal), OGRErr, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRSetAttrValue(OGRSpatialReferenceH hSRS,
                    const char * pszPath,
                    const char * pszValue) -> OGRErr

Set attribute value in spatial reference.
"""
function OSRSetAttrValue(hSRS::OGRSpatialReferenceH, pszNodePath, pszNewNodeValue)
    ccall((:OSRSetAttrValue, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring), hSRS, pszNodePath, pszNewNodeValue)
end

"""
    OSRGetAttrValue(OGRSpatialReferenceH hSRS,
                    const char * pszKey,
                    int iChild) -> const char *

Fetch indicated attribute of named node.
"""
function OSRGetAttrValue(hSRS::OGRSpatialReferenceH, pszName, iChild::Cint)
    ccall((:OSRGetAttrValue, libgdal), Cstring, (OGRSpatialReferenceH, Cstring, Cint), hSRS, pszName, iChild)
end

"""
    OSRSetAngularUnits(OGRSpatialReferenceH hSRS,
                       const char * pszUnits,
                       double dfInRadians) -> OGRErr

Set the angular units for the geographic coordinate system.
"""
function OSRSetAngularUnits(arg1::OGRSpatialReferenceH, arg2, arg3::Cdouble)
    ccall((:OSRSetAngularUnits, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetAngularUnits(OGRSpatialReferenceH hSRS,
                       char ** ppszName) -> double

Fetch angular geographic coordinate system units.
"""
function OSRGetAngularUnits(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetAngularUnits, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRSetLinearUnits(OGRSpatialReferenceH hSRS,
                      const char * pszUnits,
                      double dfInMeters) -> OGRErr

Set the linear units for the projection.
"""
function OSRSetLinearUnits(arg1::OGRSpatialReferenceH, arg2, arg3::Cdouble)
    ccall((:OSRSetLinearUnits, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRSetTargetLinearUnits(OGRSpatialReferenceH hSRS,
                            const char * pszTargetKey,
                            const char * pszUnits,
                            double dfInMeters) -> OGRErr

Set the linear units for the target node.
"""
function OSRSetTargetLinearUnits(arg1::OGRSpatialReferenceH, arg2, arg3, arg4::Cdouble)
    ccall((:OSRSetTargetLinearUnits, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cdouble), arg1, arg2, arg3, arg4)
end

"""
    OSRSetLinearUnitsAndUpdateParameters(OGRSpatialReferenceH hSRS,
                                         const char * pszUnits,
                                         double dfInMeters) -> OGRErr

Set the linear units for the projection.
"""
function OSRSetLinearUnitsAndUpdateParameters(arg1::OGRSpatialReferenceH, arg2, arg3::Cdouble)
    ccall((:OSRSetLinearUnitsAndUpdateParameters, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetLinearUnits(OGRSpatialReferenceH hSRS,
                      char ** ppszName) -> double

Fetch linear projection units.
"""
function OSRGetLinearUnits(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetLinearUnits, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRGetTargetLinearUnits(OGRSpatialReferenceH hSRS,
                            const char * pszTargetKey,
                            char ** ppszName) -> double

Fetch linear projection units.
"""
function OSRGetTargetLinearUnits(arg1::OGRSpatialReferenceH, arg2, arg3)
    ccall((:OSRGetTargetLinearUnits, libgdal), Cdouble, (OGRSpatialReferenceH, Cstring, Ptr{Cstring}), arg1, arg2, arg3)
end

"""
    OSRGetPrimeMeridian(OGRSpatialReferenceH hSRS,
                        char ** ppszName) -> double

Fetch prime meridian info.
"""
function OSRGetPrimeMeridian(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetPrimeMeridian, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{Cstring}), arg1, arg2)
end

"""
    OSRIsGeographic(OGRSpatialReferenceH hSRS) -> int

Check if geographic coordinate system.
"""
function OSRIsGeographic(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsGeographic, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsLocal(OGRSpatialReferenceH hSRS) -> int

Check if local coordinate system.
"""
function OSRIsLocal(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsLocal, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsProjected(OGRSpatialReferenceH hSRS) -> int

Check if projected coordinate system.
"""
function OSRIsProjected(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsProjected, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsCompound(OGRSpatialReferenceH hSRS) -> int

Check if the coordinate system is compound.
"""
function OSRIsCompound(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsCompound, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsGeocentric(OGRSpatialReferenceH hSRS) -> int

Check if geocentric coordinate system.
"""
function OSRIsGeocentric(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsGeocentric, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsVertical(OGRSpatialReferenceH hSRS) -> int

Check if vertical coordinate system.
"""
function OSRIsVertical(arg1::OGRSpatialReferenceH)
    ccall((:OSRIsVertical, libgdal), Cint, (OGRSpatialReferenceH,), arg1)
end

"""
    OSRIsSameGeogCS(OGRSpatialReferenceH hSRS1,
                    OGRSpatialReferenceH hSRS2) -> int

Do the GeogCS'es match?
"""
function OSRIsSameGeogCS(arg1::OGRSpatialReferenceH, arg2::OGRSpatialReferenceH)
    ccall((:OSRIsSameGeogCS, libgdal), Cint, (OGRSpatialReferenceH, OGRSpatialReferenceH), arg1, arg2)
end

"""
    OSRIsSameVertCS(OGRSpatialReferenceH hSRS1,
                    OGRSpatialReferenceH hSRS2) -> int

Do the VertCS'es match?
"""
function OSRIsSameVertCS(arg1::OGRSpatialReferenceH, arg2::OGRSpatialReferenceH)
    ccall((:OSRIsSameVertCS, libgdal), Cint, (OGRSpatialReferenceH, OGRSpatialReferenceH), arg1, arg2)
end

"""
    OSRIsSame(OGRSpatialReferenceH hSRS1,
              OGRSpatialReferenceH hSRS2) -> int

Do these two spatial references describe the same system ?
"""
function OSRIsSame(arg1::OGRSpatialReferenceH, arg2::OGRSpatialReferenceH)
    ccall((:OSRIsSame, libgdal), Cint, (OGRSpatialReferenceH, OGRSpatialReferenceH), arg1, arg2)
end

"""
    OSRSetLocalCS(OGRSpatialReferenceH hSRS,
                  const char * pszName) -> OGRErr

Set the user visible LOCAL_CS name.
"""
function OSRSetLocalCS(hSRS::OGRSpatialReferenceH, pszName)
    ccall((:OSRSetLocalCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), hSRS, pszName)
end

"""
    OSRSetProjCS(OGRSpatialReferenceH hSRS,
                 const char * pszName) -> OGRErr

Set the user visible PROJCS name.
"""
function OSRSetProjCS(hSRS::OGRSpatialReferenceH, pszName)
    ccall((:OSRSetProjCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), hSRS, pszName)
end

"""
    OSRSetGeocCS(OGRSpatialReferenceH hSRS,
                 const char * pszName) -> OGRErr

Set the user visible PROJCS name.
"""
function OSRSetGeocCS(hSRS::OGRSpatialReferenceH, pszName)
    ccall((:OSRSetGeocCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), hSRS, pszName)
end

"""
    OSRSetWellKnownGeogCS(OGRSpatialReferenceH hSRS,
                          const char * pszName) -> OGRErr

Set a GeogCS based on well known name.
"""
function OSRSetWellKnownGeogCS(hSRS::OGRSpatialReferenceH, pszName)
    ccall((:OSRSetWellKnownGeogCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), hSRS, pszName)
end

"""
    OSRSetFromUserInput(OGRSpatialReferenceH hSRS,
                        const char * pszDef) -> OGRErr

Set spatial reference from various text formats.
"""
function OSRSetFromUserInput(hSRS::OGRSpatialReferenceH, arg1)
    ccall((:OSRSetFromUserInput, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), hSRS, arg1)
end

"""
    OSRCopyGeogCSFrom(OGRSpatialReferenceH hSRS,
                      const OGRSpatialReferenceH hSrcSRS) -> OGRErr

Copy GEOGCS from another OGRSpatialReference.
"""
function OSRCopyGeogCSFrom(hSRS::OGRSpatialReferenceH, hSrcSRS::OGRSpatialReferenceH)
    ccall((:OSRCopyGeogCSFrom, libgdal), OGRErr, (OGRSpatialReferenceH, OGRSpatialReferenceH), hSRS, hSrcSRS)
end

"""
    OSRSetTOWGS84(OGRSpatialReferenceH hSRS,
                  double dfDX,
                  double dfDY,
                  double dfDZ,
                  double dfEX,
                  double dfEY,
                  double dfEZ,
                  double dfPPM) -> OGRErr

Set the Bursa-Wolf conversion to WGS84.
"""
function OSRSetTOWGS84(hSRS::OGRSpatialReferenceH, arg1::Cdouble, arg2::Cdouble, arg3::Cdouble, arg4::Cdouble, arg5::Cdouble, arg6::Cdouble, arg7::Cdouble)
    ccall((:OSRSetTOWGS84, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
end

"""
    OSRGetTOWGS84(OGRSpatialReferenceH hSRS,
                  double * padfCoeff,
                  int nCoeffCount) -> OGRErr

Fetch TOWGS84 parameters, if available.
"""
function OSRGetTOWGS84(hSRS::OGRSpatialReferenceH, arg1, arg2::Cint)
    ccall((:OSRGetTOWGS84, libgdal), OGRErr, (OGRSpatialReferenceH, Ptr{Cdouble}, Cint), hSRS, arg1, arg2)
end

"""
    OSRSetCompoundCS(OGRSpatialReferenceH hSRS,
                     const char * pszName,
                     OGRSpatialReferenceH hHorizSRS,
                     OGRSpatialReferenceH hVertSRS) -> OGRErr

Setup a compound coordinate system.
"""
function OSRSetCompoundCS(hSRS::OGRSpatialReferenceH, pszName, hHorizSRS::OGRSpatialReferenceH, hVertSRS::OGRSpatialReferenceH)
    ccall((:OSRSetCompoundCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, OGRSpatialReferenceH, OGRSpatialReferenceH), hSRS, pszName, hHorizSRS, hVertSRS)
end

"""
    OSRSetGeogCS(OGRSpatialReferenceH hSRS,
                 const char * pszGeogName,
                 const char * pszDatumName,
                 const char * pszSpheroidName,
                 double dfSemiMajor,
                 double dfInvFlattening,
                 const char * pszPMName,
                 double dfPMOffset,
                 const char * pszAngularUnits,
                 double dfConvertToRadians) -> OGRErr

Set geographic coordinate system.
"""
function OSRSetGeogCS(hSRS::OGRSpatialReferenceH, pszGeogName, pszDatumName, pszEllipsoidName, dfSemiMajor::Cdouble, dfInvFlattening::Cdouble, pszPMName, dfPMOffset::Cdouble, pszUnits, dfConvertToRadians::Cdouble)
    ccall((:OSRSetGeogCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cstring, Cdouble, Cdouble, Cstring, Cdouble, Cstring, Cdouble), hSRS, pszGeogName, pszDatumName, pszEllipsoidName, dfSemiMajor, dfInvFlattening, pszPMName, dfPMOffset, pszUnits, dfConvertToRadians)
end

"""
    OSRSetVertCS(OGRSpatialReferenceH hSRS,
                 const char * pszVertCSName,
                 const char * pszVertDatumName,
                 int nVertDatumType) -> OGRErr

Setup the vertical coordinate system.
"""
function OSRSetVertCS(hSRS::OGRSpatialReferenceH, pszVertCSName, pszVertDatumName, nVertDatumType::Cint)
    ccall((:OSRSetVertCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cint), hSRS, pszVertCSName, pszVertDatumName, nVertDatumType)
end

"""
    OSRGetSemiMajor(OGRSpatialReferenceH hSRS,
                    OGRErr * pnErr) -> double

Get spheroid semi major axis.
"""
function OSRGetSemiMajor(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetSemiMajor, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRGetSemiMinor(OGRSpatialReferenceH hSRS,
                    OGRErr * pnErr) -> double

Get spheroid semi minor axis.
"""
function OSRGetSemiMinor(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetSemiMinor, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRGetInvFlattening(OGRSpatialReferenceH hSRS,
                        OGRErr * pnErr) -> double

Get spheroid inverse flattening.
"""
function OSRGetInvFlattening(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRGetInvFlattening, libgdal), Cdouble, (OGRSpatialReferenceH, Ptr{OGRErr}), arg1, arg2)
end

"""
    OSRSetAuthority(OGRSpatialReferenceH hSRS,
                    const char * pszTargetKey,
                    const char * pszAuthority,
                    int nCode) -> OGRErr

Set the authority for a node.
"""
function OSRSetAuthority(hSRS::OGRSpatialReferenceH, pszTargetKey, pszAuthority, nCode::Cint)
    ccall((:OSRSetAuthority, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, Cint), hSRS, pszTargetKey, pszAuthority, nCode)
end

"""
    OSRGetAuthorityCode(OGRSpatialReferenceH hSRS,
                        const char * pszTargetKey) -> const char *

Get the authority code for a node.
"""
function OSRGetAuthorityCode(hSRS::OGRSpatialReferenceH, pszTargetKey)
    ccall((:OSRGetAuthorityCode, libgdal), Cstring, (OGRSpatialReferenceH, Cstring), hSRS, pszTargetKey)
end

"""
    OSRGetAuthorityName(OGRSpatialReferenceH hSRS,
                        const char * pszTargetKey) -> const char *

Get the authority name for a node.
"""
function OSRGetAuthorityName(hSRS::OGRSpatialReferenceH, pszTargetKey)
    ccall((:OSRGetAuthorityName, libgdal), Cstring, (OGRSpatialReferenceH, Cstring), hSRS, pszTargetKey)
end

"""
    OSRSetProjection(OGRSpatialReferenceH hSRS,
                     const char * pszProjection) -> OGRErr

Set a projection name.
"""
function OSRSetProjection(arg1::OGRSpatialReferenceH, arg2)
    ccall((:OSRSetProjection, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring), arg1, arg2)
end

"""
    OSRSetProjParm(OGRSpatialReferenceH hSRS,
                   const char * pszParmName,
                   double dfValue) -> OGRErr

Set a projection parameter value.
"""
function OSRSetProjParm(arg1::OGRSpatialReferenceH, arg2, arg3::Cdouble)
    ccall((:OSRSetProjParm, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetProjParm(OGRSpatialReferenceH hSRS,
                   const char * pszName,
                   double dfDefaultValue,
                   OGRErr * pnErr) -> double

Fetch a projection parameter value.
"""
function OSRGetProjParm(hSRS::OGRSpatialReferenceH, pszParmName, dfDefault::Cdouble, arg1)
    ccall((:OSRGetProjParm, libgdal), Cdouble, (OGRSpatialReferenceH, Cstring, Cdouble, Ptr{OGRErr}), hSRS, pszParmName, dfDefault, arg1)
end

"""
    OSRSetNormProjParm(OGRSpatialReferenceH hSRS,
                       const char * pszParmName,
                       double dfValue) -> OGRErr

Set a projection parameter with a normalized value.
"""
function OSRSetNormProjParm(arg1::OGRSpatialReferenceH, arg2, arg3::Cdouble)
    ccall((:OSRSetNormProjParm, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble), arg1, arg2, arg3)
end

"""
    OSRGetNormProjParm(OGRSpatialReferenceH hSRS,
                       const char * pszName,
                       double dfDefaultValue,
                       OGRErr * pnErr) -> double

This function is the same as OGRSpatialReference::
"""
function OSRGetNormProjParm(hSRS::OGRSpatialReferenceH, pszParmName, dfDefault::Cdouble, arg1)
    ccall((:OSRGetNormProjParm, libgdal), Cdouble, (OGRSpatialReferenceH, Cstring, Cdouble, Ptr{OGRErr}), hSRS, pszParmName, dfDefault, arg1)
end

"""
    OSRSetUTM(OGRSpatialReferenceH hSRS,
              int nZone,
              int bNorth) -> OGRErr

Set UTM projection definition.
"""
function OSRSetUTM(hSRS::OGRSpatialReferenceH, nZone::Cint, bNorth::Cint)
    ccall((:OSRSetUTM, libgdal), OGRErr, (OGRSpatialReferenceH, Cint, Cint), hSRS, nZone, bNorth)
end

"""
    OSRGetUTMZone(OGRSpatialReferenceH hSRS,
                  int * pbNorth) -> int

Get utm zone information.
"""
function OSRGetUTMZone(hSRS::OGRSpatialReferenceH, pbNorth)
    ccall((:OSRGetUTMZone, libgdal), Cint, (OGRSpatialReferenceH, Ptr{Cint}), hSRS, pbNorth)
end

"""
    OSRSetStatePlane(OGRSpatialReferenceH hSRS,
                     int nZone,
                     int bNAD83) -> OGRErr

Set State Plane projection definition.
"""
function OSRSetStatePlane(hSRS::OGRSpatialReferenceH, nZone::Cint, bNAD83::Cint)
    ccall((:OSRSetStatePlane, libgdal), OGRErr, (OGRSpatialReferenceH, Cint, Cint), hSRS, nZone, bNAD83)
end

"""
    OSRSetStatePlaneWithUnits(OGRSpatialReferenceH hSRS,
                              int nZone,
                              int bNAD83,
                              const char * pszOverrideUnitName,
                              double dfOverrideUnit) -> OGRErr

Set State Plane projection definition.
"""
function OSRSetStatePlaneWithUnits(hSRS::OGRSpatialReferenceH, nZone::Cint, bNAD83::Cint, pszOverrideUnitName, dfOverrideUnit::Cdouble)
    ccall((:OSRSetStatePlaneWithUnits, libgdal), OGRErr, (OGRSpatialReferenceH, Cint, Cint, Cstring, Cdouble), hSRS, nZone, bNAD83, pszOverrideUnitName, dfOverrideUnit)
end

"""
    OSRAutoIdentifyEPSG(OGRSpatialReferenceH hSRS) -> OGRErr

Set EPSG authority info if possible.
"""
function OSRAutoIdentifyEPSG(hSRS::OGRSpatialReferenceH)
    ccall((:OSRAutoIdentifyEPSG, libgdal), OGRErr, (OGRSpatialReferenceH,), hSRS)
end

"""
    OSREPSGTreatsAsLatLong(OGRSpatialReferenceH hSRS) -> int

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having lat/long coordinate ordering.
"""
function OSREPSGTreatsAsLatLong(hSRS::OGRSpatialReferenceH)
    ccall((:OSREPSGTreatsAsLatLong, libgdal), Cint, (OGRSpatialReferenceH,), hSRS)
end

"""
    OSREPSGTreatsAsNorthingEasting(OGRSpatialReferenceH hSRS) -> int

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having northing/easting coordinate ordering.
"""
function OSREPSGTreatsAsNorthingEasting(hSRS::OGRSpatialReferenceH)
    ccall((:OSREPSGTreatsAsNorthingEasting, libgdal), Cint, (OGRSpatialReferenceH,), hSRS)
end

"""
    OSRGetAxis(OGRSpatialReferenceH hSRS,
               const char * pszTargetKey,
               int iAxis,
               OGRAxisOrientation * peOrientation) -> const char *

Fetch the orientation of one axis.
"""
function OSRGetAxis(hSRS::OGRSpatialReferenceH, pszTargetKey, iAxis::Cint, peOrientation)
    ccall((:OSRGetAxis, libgdal), Cstring, (OGRSpatialReferenceH, Cstring, Cint, Ptr{OGRAxisOrientation}), hSRS, pszTargetKey, iAxis, peOrientation)
end

"""
    OSRSetAxes(OGRSpatialReferenceH hSRS,
               const char * pszTargetKey,
               const char * pszXAxisName,
               OGRAxisOrientation eXAxisOrientation,
               const char * pszYAxisName,
               OGRAxisOrientation eYAxisOrientation) -> OGRErr

Set the axes for a coordinate system.
"""
function OSRSetAxes(hSRS::OGRSpatialReferenceH, pszTargetKey, pszXAxisName, eXAxisOrientation::OGRAxisOrientation, pszYAxisName, eYAxisOrientation::OGRAxisOrientation)
    ccall((:OSRSetAxes, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cstring, OGRAxisOrientation, Cstring, OGRAxisOrientation), hSRS, pszTargetKey, pszXAxisName, eXAxisOrientation, pszYAxisName, eYAxisOrientation)
end

"""
    OSRSetACEA(OGRSpatialReferenceH hSRS,
               double dfStdP1,
               double dfStdP2,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Albers Conic Equal Area.
"""
function OSRSetACEA(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfStdP2::Cdouble, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetACEA, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetAE(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Azimuthal Equidistant.
"""
function OSRSetAE(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetAE, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetBonne(OGRSpatialReferenceH hSRS,
                double dfStdP1,
                double dfCentralMeridian,
                double dfFalseEasting,
                double dfFalseNorthing) -> OGRErr

Bonne.
"""
function OSRSetBonne(hSRS::OGRSpatialReferenceH, dfStandardParallel::Cdouble, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetBonne, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStandardParallel, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetCEA(OGRSpatialReferenceH hSRS,
              double dfStdP1,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Cylindrical Equal Area.
"""
function OSRSetCEA(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetCEA, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetCS(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Cassini-Soldner.
"""
function OSRSetCS(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetCS, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEC(OGRSpatialReferenceH hSRS,
             double dfStdP1,
             double dfStdP2,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Equidistant Conic.
"""
function OSRSetEC(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfStdP2::Cdouble, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckert(OGRSpatialReferenceH hSRS,
                 int nVariation,
                 double dfCentralMeridian,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Eckert I-VI.
"""
function OSRSetEckert(hSRS::OGRSpatialReferenceH, nVariation::Cint, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEckert, libgdal), OGRErr, (OGRSpatialReferenceH, Cint, Cdouble, Cdouble, Cdouble), hSRS, nVariation, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckertIV(OGRSpatialReferenceH hSRS,
                   double dfCentralMeridian,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Eckert IV.
"""
function OSRSetEckertIV(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEckertIV, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEckertVI(OGRSpatialReferenceH hSRS,
                   double dfCentralMeridian,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Eckert VI.
"""
function OSRSetEckertVI(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEckertVI, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEquirectangular(OGRSpatialReferenceH hSRS,
                          double dfCenterLat,
                          double dfCenterLong,
                          double dfFalseEasting,
                          double dfFalseNorthing) -> OGRErr

Equirectangular.
"""
function OSRSetEquirectangular(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEquirectangular, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetEquirectangular2(OGRSpatialReferenceH hSRS,
                           double dfCenterLat,
                           double dfCenterLong,
                           double dfStdParallel1,
                           double dfFalseEasting,
                           double dfFalseNorthing) -> OGRErr

Equirectangular generalized form.
"""
function OSRSetEquirectangular2(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfPseudoStdParallel1::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetEquirectangular2, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfPseudoStdParallel1, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGS(OGRSpatialReferenceH hSRS,
             double dfCentralMeridian,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Gall Stereograpic.
"""
function OSRSetGS(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetGS, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGH(OGRSpatialReferenceH hSRS,
             double dfCentralMeridian,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Goode Homolosine.
"""
function OSRSetGH(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetGH, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetIGH(OGRSpatialReferenceH hSRS) -> OGRErr

Interrupted Goode Homolosine.
"""
function OSRSetIGH(hSRS::OGRSpatialReferenceH)
    ccall((:OSRSetIGH, libgdal), OGRErr, (OGRSpatialReferenceH,), hSRS)
end

"""
    OSRSetGEOS(OGRSpatialReferenceH hSRS,
               double dfCentralMeridian,
               double dfSatelliteHeight,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

GEOS - Geostationary Satellite View.
"""
function OSRSetGEOS(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfSatelliteHeight::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetGEOS, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfSatelliteHeight, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGaussSchreiberTMercator(OGRSpatialReferenceH hSRS,
                                  double dfCenterLat,
                                  double dfCenterLong,
                                  double dfScale,
                                  double dfFalseEasting,
                                  double dfFalseNorthing) -> OGRErr

Gauss Schreiber Transverse Mercator.
"""
function OSRSetGaussSchreiberTMercator(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetGaussSchreiberTMercator, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetGnomonic(OGRSpatialReferenceH hSRS,
                   double dfCenterLat,
                   double dfCenterLong,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Gnomonic.
"""
function OSRSetGnomonic(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetGnomonic, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOM(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfAzimuth,
             double dfRectToSkew,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Oblique Mercator (aka HOM (variant B)
"""
function OSRSetOM(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfAzimuth::Cdouble, dfRectToSkew::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetOM, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOM(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong,
              double dfAzimuth,
              double dfRectToSkew,
              double dfScale,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Set a Hotine Oblique Mercator projection using azimuth angle.
"""
function OSRSetHOM(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfAzimuth::Cdouble, dfRectToSkew::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetHOM, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOMAC(OGRSpatialReferenceH hSRS,
                double dfCenterLat,
                double dfCenterLong,
                double dfAzimuth,
                double dfRectToSkew,
                double dfScale,
                double dfFalseEasting,
                double dfFalseNorthing) -> OGRErr

Set an Oblique Mercator projection using azimuth angle.
"""
function OSRSetHOMAC(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfAzimuth::Cdouble, dfRectToSkew::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetHOMAC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfRectToSkew, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetHOM2PNO(OGRSpatialReferenceH hSRS,
                  double dfCenterLat,
                  double dfLat1,
                  double dfLong1,
                  double dfLat2,
                  double dfLong2,
                  double dfScale,
                  double dfFalseEasting,
                  double dfFalseNorthing) -> OGRErr

Set a Hotine Oblique Mercator projection using two points on projection centerline.
"""
function OSRSetHOM2PNO(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfLat1::Cdouble, dfLong1::Cdouble, dfLat2::Cdouble, dfLong2::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetHOM2PNO, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfLat1, dfLong1, dfLat2, dfLong2, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetIWMPolyconic(OGRSpatialReferenceH hSRS,
                       double dfLat1,
                       double dfLat2,
                       double dfCenterLong,
                       double dfFalseEasting,
                       double dfFalseNorthing) -> OGRErr

International Map of the World Polyconic.
"""
function OSRSetIWMPolyconic(hSRS::OGRSpatialReferenceH, dfLat1::Cdouble, dfLat2::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetIWMPolyconic, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLat1, dfLat2, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetKrovak(OGRSpatialReferenceH hSRS,
                 double dfCenterLat,
                 double dfCenterLong,
                 double dfAzimuth,
                 double dfPseudoStdParallel1,
                 double dfScale,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Krovak Oblique Conic Conformal.
"""
function OSRSetKrovak(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfAzimuth::Cdouble, dfPseudoStdParallelLat::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetKrovak, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfAzimuth, dfPseudoStdParallelLat, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLAEA(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Lambert Azimuthal Equal-Area.
"""
function OSRSetLAEA(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetLAEA, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCC(OGRSpatialReferenceH hSRS,
              double dfStdP1,
              double dfStdP2,
              double dfCenterLat,
              double dfCenterLong,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic.
"""
function OSRSetLCC(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfStdP2::Cdouble, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetLCC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCC1SP(OGRSpatialReferenceH hSRS,
                 double dfCenterLat,
                 double dfCenterLong,
                 double dfScale,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic 1SP.
"""
function OSRSetLCC1SP(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetLCC1SP, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetLCCB(OGRSpatialReferenceH hSRS,
               double dfStdP1,
               double dfStdP2,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Lambert Conformal Conic (Belgium)
"""
function OSRSetLCCB(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfStdP2::Cdouble, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetLCCB, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfStdP2, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMC(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Miller Cylindrical.
"""
function OSRSetMC(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetMC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMercator(OGRSpatialReferenceH hSRS,
                   double dfCenterLat,
                   double dfCenterLong,
                   double dfScale,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Mercator.
"""
function OSRSetMercator(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetMercator, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMercator2SP(OGRSpatialReferenceH hSRS,
                      double dfStdP1,
                      double dfCenterLat,
                      double dfCenterLong,
                      double dfFalseEasting,
                      double dfFalseNorthing) -> OGRErr

Mercator 2SP.
"""
function OSRSetMercator2SP(hSRS::OGRSpatialReferenceH, dfStdP1::Cdouble, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetMercator2SP, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfStdP1, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetMollweide(OGRSpatialReferenceH hSRS,
                    double dfCentralMeridian,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Mollweide.
"""
function OSRSetMollweide(hSRS::OGRSpatialReferenceH, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetMollweide, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetNZMG(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

New Zealand Map Grid.
"""
function OSRSetNZMG(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetNZMG, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOS(OGRSpatialReferenceH hSRS,
             double dfOriginLat,
             double dfCMeridian,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Oblique Stereographic.
"""
function OSRSetOS(hSRS::OGRSpatialReferenceH, dfOriginLat::Cdouble, dfCMeridian::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetOS, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfOriginLat, dfCMeridian, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetOrthographic(OGRSpatialReferenceH hSRS,
                       double dfCenterLat,
                       double dfCenterLong,
                       double dfFalseEasting,
                       double dfFalseNorthing) -> OGRErr

Orthographic.
"""
function OSRSetOrthographic(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetOrthographic, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetPolyconic(OGRSpatialReferenceH hSRS,
                    double dfCenterLat,
                    double dfCenterLong,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Polyconic.
"""
function OSRSetPolyconic(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetPolyconic, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetPS(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Polar Stereographic.
"""
function OSRSetPS(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetPS, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetRobinson(OGRSpatialReferenceH hSRS,
                   double dfCenterLong,
                   double dfFalseEasting,
                   double dfFalseNorthing) -> OGRErr

Robinson.
"""
function OSRSetRobinson(hSRS::OGRSpatialReferenceH, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetRobinson, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetSinusoidal(OGRSpatialReferenceH hSRS,
                     double dfCenterLong,
                     double dfFalseEasting,
                     double dfFalseNorthing) -> OGRErr

Sinusoidal.
"""
function OSRSetSinusoidal(hSRS::OGRSpatialReferenceH, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetSinusoidal, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetStereographic(OGRSpatialReferenceH hSRS,
                        double dfOriginLat,
                        double dfCMeridian,
                        double dfScale,
                        double dfFalseEasting,
                        double dfFalseNorthing) -> OGRErr

Stereographic.
"""
function OSRSetStereographic(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetStereographic, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetSOC(OGRSpatialReferenceH hSRS,
              double dfLatitudeOfOrigin,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Swiss Oblique Cylindrical.
"""
function OSRSetSOC(hSRS::OGRSpatialReferenceH, dfLatitudeOfOrigin::Cdouble, dfCentralMeridian::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetSOC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLatitudeOfOrigin, dfCentralMeridian, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTM(OGRSpatialReferenceH hSRS,
             double dfCenterLat,
             double dfCenterLong,
             double dfScale,
             double dfFalseEasting,
             double dfFalseNorthing) -> OGRErr

Transverse Mercator.
"""
function OSRSetTM(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetTM, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMVariant(OGRSpatialReferenceH hSRS,
                    const char * pszVariantName,
                    double dfCenterLat,
                    double dfCenterLong,
                    double dfScale,
                    double dfFalseEasting,
                    double dfFalseNorthing) -> OGRErr

Transverse Mercator variant.
"""
function OSRSetTMVariant(hSRS::OGRSpatialReferenceH, pszVariantName, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetTMVariant, libgdal), OGRErr, (OGRSpatialReferenceH, Cstring, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, pszVariantName, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMG(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

Tunesia Mining Grid.
"""
function OSRSetTMG(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetTMG, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTMSO(OGRSpatialReferenceH hSRS,
               double dfCenterLat,
               double dfCenterLong,
               double dfScale,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

Transverse Mercator (South Oriented)
"""
function OSRSetTMSO(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble, dfScale::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetTMSO, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong, dfScale, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetTPED(OGRSpatialReferenceH hSRS,
               double dfLat1,
               double dfLong1,
               double dfLat2,
               double dfLong2,
               double dfFalseEasting,
               double dfFalseNorthing) -> OGRErr

TPED (Two Point Equi Distant)
"""
function OSRSetTPED(hSRS::OGRSpatialReferenceH, dfLat1::Cdouble, dfLong1::Cdouble, dfLat2::Cdouble, dfLong2::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetTPED, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfLat1, dfLong1, dfLat2, dfLong2, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetVDG(OGRSpatialReferenceH hSRS,
              double dfCentralMeridian,
              double dfFalseEasting,
              double dfFalseNorthing) -> OGRErr

VanDerGrinten.
"""
function OSRSetVDG(hSRS::OGRSpatialReferenceH, dfCenterLong::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetVDG, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble), hSRS, dfCenterLong, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetWagner(OGRSpatialReferenceH hSRS,
                 int nVariation,
                 double dfCenterLat,
                 double dfFalseEasting,
                 double dfFalseNorthing) -> OGRErr

Wagner I  VII.
"""
function OSRSetWagner(hSRS::OGRSpatialReferenceH, nVariation::Cint, dfCenterLat::Cdouble, dfFalseEasting::Cdouble, dfFalseNorthing::Cdouble)
    ccall((:OSRSetWagner, libgdal), OGRErr, (OGRSpatialReferenceH, Cint, Cdouble, Cdouble, Cdouble), hSRS, nVariation, dfCenterLat, dfFalseEasting, dfFalseNorthing)
end

"""
    OSRSetQSC(OGRSpatialReferenceH hSRS,
              double dfCenterLat,
              double dfCenterLong) -> OGRErr

Quadrilateralized Spherical Cube.
"""
function OSRSetQSC(hSRS::OGRSpatialReferenceH, dfCenterLat::Cdouble, dfCenterLong::Cdouble)
    ccall((:OSRSetQSC, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble), hSRS, dfCenterLat, dfCenterLong)
end

"""
    OSRSetSCH(OGRSpatialReferenceH hSRS,
              double dfPegLat,
              double dfPegLong,
              double dfPegHeading,
              double dfPegHgt) -> OGRErr

Spherical, Cross-track, Height.
"""
function OSRSetSCH(hSRS::OGRSpatialReferenceH, dfPegLat::Cdouble, dfPegLong::Cdouble, dfPegHeading::Cdouble, dfPegHgt::Cdouble)
    ccall((:OSRSetSCH, libgdal), OGRErr, (OGRSpatialReferenceH, Cdouble, Cdouble, Cdouble, Cdouble), hSRS, dfPegLat, dfPegLong, dfPegHeading, dfPegHgt)
end

"""
    OSRCalcInvFlattening(double dfSemiMajor,
                         double dfSemiMinor) -> double

Compute inverse flattening from semi-major and semi-minor axis.

### Parameters
* **dfSemiMajor**: Semi-major axis length.
* **dfSemiMinor**: Semi-minor axis length.

### Returns
inverse flattening, or 0 if both axis are equal.
"""
function OSRCalcInvFlattening(dfSemiMajor::Cdouble, dfSemiMinor::Cdouble)
    ccall((:OSRCalcInvFlattening, libgdal), Cdouble, (Cdouble, Cdouble), dfSemiMajor, dfSemiMinor)
end

"""
    OSRCalcSemiMinorFromInvFlattening(double dfSemiMajor,
                                      double dfInvFlattening) -> double

Compute semi-minor axis from semi-major axis and inverse flattening.

### Parameters
* **dfSemiMajor**: Semi-major axis length.
* **dfInvFlattening**: Inverse flattening or 0 for sphere.

### Returns
semi-minor axis
"""
function OSRCalcSemiMinorFromInvFlattening(dfSemiMajor::Cdouble, dfInvFlattening::Cdouble)
    ccall((:OSRCalcSemiMinorFromInvFlattening, libgdal), Cdouble, (Cdouble, Cdouble), dfSemiMajor, dfInvFlattening)
end

"""
    OSRCleanup(void) -> void

Cleanup cached SRS related memory.
"""
function OSRCleanup()
    ccall((:OSRCleanup, libgdal), Void, ())
end

"""
    OCTNewCoordinateTransformation(OGRSpatialReferenceH hSourceSRS,
                                   OGRSpatialReferenceH hTargetSRS) -> OGRCoordinateTransformationH

Create transformation object.

### Parameters
* **hSourceSRS**: source spatial reference system.
* **hTargetSRS**: target spatial reference system.

### Returns
NULL on failure or a ready to use transformation object.
"""
function OCTNewCoordinateTransformation(hSourceSRS::OGRSpatialReferenceH, hTargetSRS::OGRSpatialReferenceH)
    ccall((:OCTNewCoordinateTransformation, libgdal), OGRCoordinateTransformationH, (OGRSpatialReferenceH, OGRSpatialReferenceH), hSourceSRS, hTargetSRS)
end

"""
    OCTDestroyCoordinateTransformation(OGRCoordinateTransformationH hCT) -> void

OGRCoordinateTransformation destructor.

### Parameters
* **hCT**: the object to delete
"""
function OCTDestroyCoordinateTransformation(arg1::OGRCoordinateTransformationH)
    ccall((:OCTDestroyCoordinateTransformation, libgdal), Void, (OGRCoordinateTransformationH,), arg1)
end

"""
    OCTTransform(OGRCoordinateTransformationH hTransform,
                 int nCount,
                 double * x,
                 double * y,
                 double * z) -> int

Transform an array of points.

### Parameters
* **hTransform**: Transformation object
* **nCount**: Number of points
* **x**: Array of nCount x values.
* **y**: Array of nCount y values.
* **z**: Array of nCount z values.

### Returns
TRUE or FALSE
"""
function OCTTransform(hCT::OGRCoordinateTransformationH, nCount::Cint, x, y, z)
    ccall((:OCTTransform, libgdal), Cint, (OGRCoordinateTransformationH, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), hCT, nCount, x, y, z)
end

"""
    OCTTransformEx(OGRCoordinateTransformationH hTransform,
                   int nCount,
                   double * x,
                   double * y,
                   double * z,
                   int * pabSuccess) -> int

Transform an array of points.

### Parameters
* **hTransform**: Transformation object
* **nCount**: Number of points
* **x**: Array of nCount x values.
* **y**: Array of nCount y values.
* **z**: Array of nCount z values.
* **pabSuccess**: Output array of nCount value that will be set to TRUE/FALSE

### Returns
TRUE or FALSE
"""
function OCTTransformEx(hCT::OGRCoordinateTransformationH, nCount::Cint, x, y, z, pabSuccess)
    ccall((:OCTTransformEx, libgdal), Cint, (OGRCoordinateTransformationH, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cint}), hCT, nCount, x, y, z, pabSuccess)
end

"""
    OCTProj4Normalize(const char * pszProj4Src) -> char *
"""
function OCTProj4Normalize(pszProj4Src)
    ccall((:OCTProj4Normalize, libgdal), Cstring, (Cstring,), pszProj4Src)
end

"""
    OCTCleanupProjMutex() -> void
"""
function OCTCleanupProjMutex()
    ccall((:OCTCleanupProjMutex, libgdal), Void, ())
end

"""
    OPTGetProjectionMethods() -> char **

Fetch list of possible projection methods.

### Returns
Returns NULL terminated list of projection methods. This should be freed with CSLDestroy() when no longer needed.
"""
function OPTGetProjectionMethods()
    ccall((:OPTGetProjectionMethods, libgdal), Ptr{Cstring}, ())
end

"""
    OPTGetParameterList(const char * pszProjectionMethod,
                        char ** ppszUserName) -> char **

Fetch the parameters for a given projection method.

### Parameters
* **pszProjectionMethod**: internal name of projection methods to fetch the parameters for, such as "Transverse_Mercator" (SRS_PT_TRANSVERSE_MERCATOR).
* **ppszUserName**: pointer in which to return a user visible name for the projection name. The returned string should not be modified or freed by the caller. Legal to pass in NULL if user name not required.

### Returns
returns a NULL terminated list of internal parameter names that should be freed by the caller when no longer needed. Returns NULL if projection method is unknown.
"""
function OPTGetParameterList(pszProjectionMethod, ppszUserName)
    ccall((:OPTGetParameterList, libgdal), Ptr{Cstring}, (Cstring, Ptr{Cstring}), pszProjectionMethod, ppszUserName)
end

"""
    OPTGetParameterInfo(const char * pszProjectionMethod,
                        const char * pszParameterName,
                        char ** ppszUserName,
                        char ** ppszType,
                        double * pdfDefaultValue) -> int

Fetch information about a single parameter of a projection method.

### Parameters
* **pszProjectionMethod**: name of projection method for which the parameter applies. Not currently used, but in the future this could affect defaults. This is the internal projection method name, such as "Tranverse_Mercator".
* **pszParameterName**: name of the parameter to fetch information about. This is the internal name such as "central_meridian" (SRS_PP_CENTRAL_MERIDIAN).
* **ppszUserName**: location at which to return the user visible name for the parameter. This pointer may be NULL to skip the user name. The returned name should not be modified or freed.
* **ppszType**: location at which to return the parameter type for the parameter. This pointer may be NULL to skip. The returned type should not be modified or freed. The type values are described above.
* **pdfDefaultValue**: location at which to put the default value for this parameter. The pointer may be NULL.

### Returns
TRUE if parameter found, or FALSE otherwise.
"""
function OPTGetParameterInfo(pszProjectionMethod, pszParameterName, ppszUserName, ppszType, pdfDefaultValue)
    ccall((:OPTGetParameterInfo, libgdal), Cint, (Cstring, Cstring, Ptr{Cstring}, Ptr{Cstring}, Ptr{Cdouble}), pszProjectionMethod, pszParameterName, ppszUserName, ppszType, pdfDefaultValue)
end


text:
using Test
using Cleaner: CleanTable, row_as_names, names, size

@testset "row_as_names is working as expected" begin
    testCT = CleanTable([:A, :B, :C], [[1, 2, "x", 4], [5, 6, "y", 7], ["x", "y", "z", "a"]])

    @test names(row_as_names(testCT, 3)) == Symbol[:x, :y, :z]
    @test size(row_as_names(testCT, 3)) == (1, 3)
    @test size(row_as_names(testCT, 3, remove=false)) == (4, 3)

    let err = nothing
        try
            row_as_names(testCT, 5)
        catch err
        end

        @test err isa Exception
        @test sprint(showerror, err) == "`i` can't be greater than the amount of rows"
    end
end

ext: jl

max_stars_repo_name: TheRoniOne/Cleaner

max_issues_repo_name: TheRoniOne/Cleaner

max_forks_repo_name: TheRoniOne/Cleaner


text:
# function.jl

"""
Uses the AbstractPlotting.jl and MakieLayout.jl plotting packages to produce 3D interactive graphs of complex functions. The Real and Imaginary parts of the function are displayed side-by-side in two different 3D plots and can be altered by any finite number of sliders to change the value of any arguments they may depend on. Axis sliders are also present to either widen or focus the area of the graphs under investigation.
"""

mutable struct FunctionView
    params::Any
    sliders::Any
    annotations::Any
    limits::Any
    ℜ_matrix::Any
    ℑ_matrix::Any
    scenes::Any
    layout::Any
end
FunctionView(xs::AbstractArray) = FunctionView(xs..., [], [])

function functionview(
    ℜ,
    ℑ,
    params::Tuple,
    sliders::Tuple,
    annotations::Dict{String,String};
    axis_limits = ((-20, 20), (-20, 20), (-20, 20)),
    len = 100,
)

    x_lim = lift(x -> range(axis_limits[1][1], stop = x, length = len), sliders[1].value)
    y_lim = lift(x -> range(axis_limits[2][1], stop = x, length = len), sliders[2].value)
    limits = (x_lim, y_lim)

    ℜ_matrix = lift(map(s -> s.value, sliders)...) do x_max, y_max, z_max, params...
        ℜf(x, y) = ℜ(x, y, params...)
        [
            ifelse(abs(ℜf(x, y)) < z_max, ℜf(x, y), NaN)
            for
            x in range(axis_limits[1][1], stop = x_max, length = len),
            y in range(axis_limits[2][1], stop = y_max, length = len)
        ]
    end

    ℑ_matrix = lift(map(s -> s.value, sliders)...) do x_max, y_max, z_max, params...
        ℑf(x, y) = ℑ(x, y, params...)
        [
            ifelse(abs(ℑf(x, y)) < z_max, ℑf(x, y), NaN)
            for
            x in range(axis_limits[1][1], stop = x_max, length = len),
            y in range(axis_limits[2][1], stop = y_max, length = len)
        ]
    end

    return FunctionView(map(
        x -> x,
        [params, sliders, annotations, limits, ℜ_matrix, ℑ_matrix],
    ))
end

function viewfunction(
    ℜ,
    ℑ,
    params::Tuple,
    param_initial_values::Tuple,
    param_limits,
    annotations::Dict{String,String};
    axis_limits = ((-20, 20), (-20, 20), (-20, 20)),
    len = 100,
    resolution = (1500, 800),
)
    # Set the scene
    outer_padding = 30
    scene, layout = layoutscene(
        outer_padding,
        resolution = resolution,
        backgroundcolor = RGBf0(0.99, 0.99, 0.99),
    )
    makescene() = LScene(
        scene,
        camera = cam3d!,
        raw = true,
        scenekw = (backgroundcolor = RGBf0(0.96, 0.96, 0.96), clear = false),
    )

    real_scene = layout[2, 2] = makescene()
    imag_scene = layout[2, 3] = makescene()

    colsize!(layout, 2, Relative(0.45))
    colsize!(layout, 3, Relative(0.45))

    real_scene_title =
        layout[1, 2] = LText(
            scene,
            annotations["ℜ_title"],
            textsize = 20,
            padding = (0, 0, 10, 0),
            font = "Noto Sans Bold",
            tellwidth = false,
        )
    imag_scene_title =
        layout[1, 3] = LText(
            scene,
            annotations["ℑ_title"],
            textsize = 20,
            padding = (0, 0, 10, 0),
            font = "Noto Sans Bold",
            tellwidth = false,
        )

    # Axis sliders

    sliders = []
    coordinates = ("x", "y", "z")

    for c = 1:length(coordinates)
        coord = coordinates[c]
        slider_label = Symbol(coord, '_', "slider", '_', "label")
        slider = Symbol(coord, '_', "slider")
        slider_value = Symbol(coord, '_', "slider", '_', "value")

        @eval $slider_label = $(layout[3+c, 1] = LText(scene, coord, textsize = 20))

        @eval $slider =
            $(
                layout[3+c, 2:3] = LSlider(
                    scene,
                    range = axis_limits[c][1]:0.01:axis_limits[c][2],
                    horizontal = true,
                    tellheight = true,
                    width = nothing,
                    height = Auto(),
                    startvalue = axis_limits[c][2],
                )
            )
        @eval value = $slider.value
        @eval $slider_value =
            $(layout[3+c, 4] = LText(scene, lift(x -> "$(x)", value), textsize = 20))

        push!(sliders, eval(slider))
    end

    # Parameter sliders

    para_num = length(params)

    for p = 1:para_num
        param = params[p]
        slider_label = Symbol(param, '_', "slider", '_', "label")
        slider = Symbol(param, '_', "slider")
        slider_value = Symbol(param, '_', "slider", '_', "value")

        @eval $slider_label = $(layout[1, 4+p] = LText(scene, "$(param)", textsize = 20))
        @eval $slider =
            $(
                layout[2, 4+p] = LSlider(
                    scene,
                    range = param_limits[p][1]:0.01:param_limits[p][2],
                    horizontal = false,
                    tellwidth = true,
                    height = nothing,
                    width = Auto(),
                    startvalue = param_initial_values[p],
                )
            )
        @eval value = $slider.value
        @eval $slider_value =
            $(layout[3, 4+p] = LText(scene, lift(x -> "$(x)", value), textsize = 20))

        push!(sliders, eval(slider))
        colsize!(layout, 4 + p, Relative(0.07 / para_num))
    end

    sliders = tuple(sliders...)

    # Title
    title =
        layout[0, :] = LText(
            scene,
            "PolaronMakie.jl",
            textsize = 30,
            padding = (0, 0, 50, 0),
            font = "Noto Sans Bold",
            color = (:black, 0.25),
        )

    # Function data
    fv = functionview(ℜ, ℑ, params, sliders, annotations, axis_limits = axis_limits)

    # Plotting
    sℜ = AbstractPlotting.surface!(real_scene, fv.limits[1], fv.limits[2], fv.ℜ_matrix)
    cℜ = AbstractPlotting.contour!(
        real_scene,
        fv.limits[1],
        fv.limits[2],
        fv.ℜ_matrix,
        levels = 30,
        linewidth = 1,
        transformation = (:xy, -5.0 + minimum(filter(!isnan, [to_value(fv.ℜ_matrix)...]))),
    )
    AbstractPlotting.wireframe!(
        real_scene,
        fv.limits[1],
        fv.limits[2],
        fv.ℜ_matrix,
        overdraw = true,
        transparency = true,
        color = (:black, 0.15),
    )

    sℑ = AbstractPlotting.surface!(
        imag_scene,
        fv.limits[1],
        fv.limits[2],
        fv.ℑ_matrix,
        scale_plot = false,
    )
    cℑ = AbstractPlotting.contour!(
        imag_scene,
        fv.limits[1],
        fv.limits[2],
        fv.ℑ_matrix,
        levels = 30,
        linewidth = 1,
        transformation = (:xy, -5.0 + minimum(filter(!isnan, [to_value(fv.ℑ_matrix)...]))),
    )

    AbstractPlotting.wireframe!(
        imag_scene,
        fv.limits[1],
        fv.limits[2],
        fv.ℑ_matrix,
        overdraw = true,
        transparency = true,
        color = (:black, 0.15),
    )

    lift(fv.ℜ_matrix, fv.ℑ_matrix, z_slider.value) do ℜz, ℑz, z
        AbstractPlotting.translate!(cℜ, 0, 0, -5.0 + minimum(filter(!isnan, [to_value(ℜz)...])))
        AbstractPlotting.translate!(cℑ, 0, 0, -5.0 + minimum(filter(!isnan, [to_value(ℑz)...])))
    end

    AbstractPlotting.display(scene)

    fv.scenes = [scene, real_scene, imag_scene]
    fv.layout = layout

    return fv
end


text:
##########################
# FunctionCell Interface #
##########################
"""
	dbscan(eps::Real, minpts::Int64, f::Function)

Constructs an untrained cell that when piped data inside, clusters the data using the
DBSCAN algorithm; this implementation of the  algorithm expects as input a square
simmetrical distance matrix.

# Arguments
  * `eps` is the radius of observation neighbourhood
  * `minpts` is the minimum number of neighbouring points (including itself) to qualify a point as a density point
  * `f` is a function that is used to calculate a quantity representative of how a point differs/is
  similar to the cluster seed observations generated by the clustering algorithm.

One could use `f=(x,y)->Distances.pairwise(Distances.Euclidean(),x,y))` where `x` are the
seed samples of the clusters and `y` is test data. The recovery of the clusters can be
done with `targets(indmin, ...)`.

Read the `Clustering.jl` documentation for more information.
"""
dbscan(eps::Real, minpts::Int, f::Function) = FunctionCell(dbscan, (eps,minpts,f), ModelProperties(), "DBSCAN (ɛ=$eps, minpts=$minpts)")

############################
# DataCell/Array Interface #
############################
"""
	dbscan(x, eps::Real, minpts::Int64, f::Function)

The DBSCAN clustering algorithm trainig. `x` is expected to be a distance matrix. Returns a trained
function cell that when piped data into will apply `f` between the seed points of the found
clusters and each of the input observations.
"""
# Training
dbscan(x::T where T<:CellData, eps::Real, minpts::Int, f::Function) = dbscan(getx!(x), eps, minpts, f)
dbscan(x::T where T<:AbstractVector, eps::Real, minpts::Int, f::Function) = dbscan(mat(x, LearnBase.ObsDim.Constant{2}()), eps, minpts, f)
dbscan(x::T where T<:AbstractMatrix, eps::Real, minpts::Int, f::Function) = begin

	# Perform clustering
	dbscandata = Clustering.dbscan(x, eps, minpts)

	# Build model properties
	modelprops = ModelProperties(nvars(x),length(dbscandata.seeds))

	FunctionCell(dbscan, Model((f, x[:,sort(dbscandata.seeds)], dbscandata), modelprops), "DBSCAN (ɛ=$eps, minpts=$minpts)");
end

# Execution
dbscan(x::T where T<:CellData, model::Model{<:Tuple{<:Function, <:AbstractArray, <:Clustering.DbscanResult}}) =
	datacell(dbscan(getx!(x), model), gety(x))
dbscan(x::T where T<:AbstractVector, model::Model{<:Tuple{<:Function, <:AbstractArray, <:Clustering.DbscanResult}}) =
	dbscan(mat(x, LearnBase.ObsDim.Constant{2}()), model)
dbscan(x::T where T<:AbstractMatrix, model::Model{<:Tuple{<:Function, <:AbstractArray, <:Clustering.DbscanResult}}) =
	model.data[1](model.data[2],x) # f(seeds,x)

"""
	dbscan(radius ,f::Function [;kwargs])

This implementation of the  algorithm expects as input a training data matrix.
`radius` is the radius of an observation neighbourhood and again, `f` is a
function that is used to calculate a quantity representative of how a point differs/is
similar to the clusters generated by the training data.

For this implementation of DBSCAN, `f` has implement a distance between a point and
a set of points. One could define:
`g(d,Ε)= (x,S) -> Ε([d(p, getobs(S,i)) for i in nobs(S)])` and use `f=g(Distances.euclidean, mean)`,
where 'd' is a point-wise distance function, `S` is a cluster of points and Ε is an
aggregation function that processes all distances between point and cluster.

# Keyword arguments (same as in `Clustering`)
  * `leafsize` number of points binned in each leaf of the KDTree (default `20`)
  * `min_neighbors` minimum number of neighbors to be a core point (default `1`)
  * `min_cluster_size` is the minimum number of points to be a valid cluster (default `1`)

Read the `Clustering.jl` documentation for more information.
"""
dbscan(radius::Real, f::Function; kwargs...) = FunctionCell(dbscan, (radius,f), ModelProperties(), kwtitle("DBSCAN (radius=$radius)",kwargs); kwargs...)

############################
# DataCell/Array Interface #
############################
"""
	dbscan(x, radius::Real [,f::Function] [;kwargs])

The DBSCAN clustering algorithm trainig. `x` is expected to be a data matrix. Returns a trained
function cell that when piped data into will apply `f` between the core points of the found
clusters and each of the input observations.
"""
# Training
dbscan(x::T where T<:CellData, radius::Real, f::Function; kwargs...) = dbscan(getx!(x), radius, f; kwargs...)
dbscan(x::T where T<:AbstractVector, radius::Real, f::Function; kwargs...) = dbscan(mat(x, LearnBase.ObsDim.Constant{2}()), radius, f; kwargs...)
dbscan(x::T where T<:AbstractMatrix, radius::Real, f::Function; kwargs...) = begin

	# Perform clustering
	dbscandata = Clustering.dbscan(x, radius; kwargs...)

	# Build model properties
	modelprops = ModelProperties(nvars(x), length(dbscandata))
	core_data = [x[:,dbscandata[i].core_indices] for i in 1:length(dbscandata)]
	FunctionCell(dbscan, Model((f,core_data), modelprops), kwtitle("DBSCAN (radius=$radius)",kwargs)); # model is not stored, all information needed is in modelprops
end

# Execution
dbscan(x::T where T<:CellData, model::Model{<:Tuple{<:Function, <:AbstractArray}}) =
	datacell(dbscan(getx!(x), model), gety(x))
dbscan(x::T where T<:AbstractVector, model::Model{<:Tuple{<:Function, <:AbstractArray}}) =
	dbscan(mat(x, LearnBase.ObsDim.Constant{2}()), model)
dbscan(x::T where T<:AbstractMatrix, model::Model{<:Tuple{<:Function, <:AbstractArray}}) = begin
	# Pre-allocate
	R = zeros(Float64, model.properties.odim, nobs(x))
	f = model.data[1]
	@inbounds for k in 1:model.properties.odim
		cluster_data = model.data[2][k]
		@simd for i in 1:nobs(x)
			@fastmath R[k,i] = f(getobs(x,i), cluster_data)
		end
	end
	return R
end


text:
function run_1D_benchmark(;algorithm=MetropolisHastings(), nsteps=10^5, nchains=8)
    for i in 1:length(testfunctions_1D)
        sample_stats_all = run1D(
            collect(keys(testfunctions_1D))[i], #There might be a nicer way but I need the name to save the plots
            testfunctions_1D,
            sample_stats[i],
            run_stats[i],
            algorithm,
            nsteps,
            nchains
        )
    end
    make_1D_results(testfunctions_1D,sample_stats)
    save_stats_1D(collect(keys(testfunctions_1D)),run_stats,run_stats_names)
end


text:
# Final part for the global upstream reconnection efficiency estimation.
# Procedures:
# 1. Read in the processed reconnection rate data from Hall MHD and MHD-EPIC
# 2. Visualize the time series
# 3. Periodogram analysis with FFT, Welch method and Savitzky-Golay filter.
#
# Note that in the common log scale, the FFT doesn't show any significant peaks!
#
# Hongyang Zhou, hyzhou@umich.edu 04/14/2020

using FFTW, PyPlot, DelimitedFiles
using DSP, Statistics

if !isdefined(Main, :Ganymede)
   include("../Ganymede.jl")
   using .Ganymede: Rg, upstream_value
end

# Background
# G8 B= -10 -6 -86 [nT], U=140 0 0 [km/s]
Uxbk = upstream_value[2]
Bybk = upstream_value[6]
Bzbk = upstream_value[7]
TiltedAngle = atan(Bybk/Bzbk)

dirHallSurface = "dataSurf_Hall/"
dirPICSurface = "dataSurf_PIC/"

##
# Get upstream theoretical maximum potential drop
Δy = 4.1 # or 5.64 [Rg], from z=2 cut estimation

# Take clock angle in yz plane into consideration, 179 [kV]
Potential_bk = Δy * cos(TiltedAngle) * Rg *
   Uxbk*1e3 * abs(Bzbk*cos(TiltedAngle)+Bybk*sin(TiltedAngle))*1e-9 *
   1e-3 # [kV]

data_hall = readdlm(dirHallSurface*"CPCP_test.txt", comments=true)
data_pic  = readdlm(dirPICSurface*"CPCP_test.txt", comments=true)
data_pic[:,1] .-= 300.

if size(data_hall) != size(data_pic)
   @warn "Hall ($(size(data_hall)[1])) and MHD-EPIC ($(size(data_pic)[1])) " *
   "have different snapshots!"
end

Fs = 1                 # Sampling frequency
T = 1/Fs               # Sampling period
L = size(data_hall)[1] # Length of signal
t = (0:L-1)*T          # Time vector

#missingtime = setdiff(0:1200,data_hall[:,1]) # Check missing frames

e_hall = data_hall[:,2] ./ Potential_bk
e_pic  = data_pic[:,2] ./ Potential_bk

r_hall_mean = mean(data_hall[101:end,2])
r_hall_std = std(data_hall[101:end,2])
r_pic_mean = mean(data_pic[:,2])
r_pic_std = std(data_pic[:,2])

hall_mean = fill(r_hall_mean, size(e_hall))
pic_mean = fill(r_pic_mean, size(e_pic))

##
fig, ax = plt.subplots(3,1,figsize=(10.0,8.0))
plt.rc("font", family = "serif", size = 13)

ax[1].plot(data_hall[:,1], data_hall[:,2], label="Hall MHD")
ax[1].plot(data_hall[:,1], hall_mean, "k--", linewidth=0.8, label="Hall mean")
ax[1].plot(data_hall[end,1]:data_hall[end,1]+19, fill(r_hall_mean, 20), "k--",
   linewidth=0.8)
ax[1].errorbar(data_hall[end,1]+20., r_hall_mean, yerr=r_hall_std, ecolor="C0",
   capsize=3)

ax[1].set_xlim(-10.,1230.)
ax[1].set_ylim(30,135)
ax[1].set_xlabel("Simulation time [s]")
ax[1].set_ylabel("Reconnection rate [kV]")
ax[1].legend(loc="lower left", bbox_to_anchor=(0.07, 0.9), ncol=2,
   frameon=false)

ax[1].minorticks_on()
ax[1].tick_params(which="both", direction="in")
ax[1].annotate("(a)", xy=(-0.03, 1.01), xycoords="axes fraction", fontsize=14)

ax[2].plot(data_pic[:,1], data_pic[:,2], "C1", alpha=1.0, label="MHD-EPIC")
ax[2].plot(data_pic[:,1], pic_mean, "k--", linewidth=0.8, label="MHD-EPIC mean")
ax[2].plot(data_pic[end,1]:data_pic[end,1]+19, fill(r_pic_mean, 20), "k--",
   linewidth=0.8)
ax[2].errorbar(data_pic[end,1]+20, r_pic_mean, yerr=r_pic_std, ecolor="C1",
   capsize=3)

ax[2].set_xlim(-10.,1230.)
ax[2].set_ylim(35,130)
ax[2].set_xlabel("Simulation time [s]")
ax[2].set_ylabel("Reconnection rate [kV]")
ax[2].legend(loc="lower left", bbox_to_anchor=(0.07, 0.9), ncol=2,
      frameon=false)

ax[2].minorticks_on()
ax[2].tick_params(which="both", direction="in")
ax[2].annotate("(b)", xy=(-0.03, 1.01), xycoords="axes fraction", fontsize=14)

# FTE
#=
peak_pic = [34, 128, 230, 278, 347, 385, 434, 473, 656, 716, 727,
1016, 1083, 1116, 1151, 1181] .+ 10

peak_hall = [112, 153, 210, 352, 385, 412, 450, 462, 488, 515, 564, 636,
686, 755, 780, 797, 886, 930, 998, 1066, 1087, 1160] .+ 15
=#

# Check downwards FTEs!!!

peak_hall = [115, 153, 213, 355, 384, 413, 450, 488, 514, 559, 580, 639,
683, 712, 756, 774, 784, 797, 886, 927, 998, 1067, 1090, 1163, 1190]

peak_hall_Dn = [13, 41, 59, 112, 135, 193, 300, 580, 696,
758, 810, 845, 929, 981, 1001, 1033, 1048, 1059, 1078, 1170]

#append!(peak_hall,[13, 41, 59, 112, 135, 193, 300, 580, 696,
#758, 810, 845, 929, 981, 1001, 1033, 1048, 1059, 1078, 1170])

peak_pic = [35, 126, 230, 278, 345, 385, 436, 473, 653, 706, 715,
1010, 1085, 1118, 1150, 1183]
peak_pic_Dn = [7, 247, 262, 313, 336, 410, 477, 484, 499, 552, 617, 990, 1001,
1029, 1039, 1053, 1067] # downwards peaks

#append!(peak_pic,[7, 247, 262, 313, 336, 410, 477, 484, 499, 552, 617, 990, 1001,
#1029, 1039, 1053, 1067])

for t in peak_hall
   #=
   if t < 600
      ax[1].plot(t, e_hall[t], linestyle="", marker="o",
         markerfacecolor="k", markeredgecolor="None")
   else # there are 3 missing frames in the Hall outputs around 900s
      ax[1].plot(t, e_hall[t-3], linestyle="", marker="o",
         markerfacecolor="k", markeredgecolor="None")
   end
   =#
   #ax[1].plot(data_hall[t], e_hall[t], linestyle="", marker="o",
   #   markerfacecolor="k", markeredgecolor="None")
   ax[1].axvline(x=t, ls="-.", linewidth=0.8, color="r")
end

for t in peak_hall_Dn
   ax[1].axvline(x=t, ls=":", linewidth=0.8, color="g")
end

for t in peak_pic
   #ax[1].plot(t+300, e_pic[t], linestyle="", marker="o",
   #   markerfacecolor="r", markeredgecolor="None")
   #ax[1].plot(data_pic[t], e_pic[t], linestyle="", marker="o",
   #   markerfacecolor="r", markeredgecolor="None")
   ax[2].axvline(x=t, ls="-.", linewidth=0.8, color="r")
end

for t in peak_pic_Dn
   ax[2].axvline(x=t, ls=":", linewidth=0.8, color="g")
end

#include("satelliteAnalysis.jl")
#peak_hall = satellite_p_contour("satellites_y0_Hall.txt"; No=1, plane='y')
#peak_pic  = satellite_p_contour("satellites_y0_PIC.txt"; No=2, plane='y')
#=
# Check missing frames
MissHall = [355, 457, 505, 568]
MissPIC = [567, 591, 610, 680]
tHall = Set(0:1200)
tPIC = Set(0:1200)
for value in MissHall
   delete!(tHall,value)
end
for value in MissPIC
   delete!(tPIC,value)
end
tHall = sort(collect(tHall))
tPIC = sort(collect(tPIC))

ax1 = ax[1].twinx()  # instantiate a second axes that shares the same x-axis

ax1.set_ylabel("p perturbation", color="C2")  # we already handled the x-label with ax1
ax1.plot(tHall, pMeanHall, color="C2")
ax1.tick_params(axis="y", labelcolor="C2")

ax2 = ax[2].twinx()  # instantiate a second axes that shares the same x-axis

ax2.set_ylabel("p perturbation", color="C2")  # we already handled the x-label with ax1
ax2.plot(tPIC, pMeanPIC, color="C2")
ax2.tick_params(axis="y", labelcolor="C2")
=#
##

#Yhall = welch_pgram(data_hall[121:end,2]; onesided=true, fs=Fs)
#Ypic = welch_pgram(data_pic[:,2]; onesided=true, fs=Fs)
Yhall = periodogram(data_hall[121:end,2], onesided=true, nfft=L-120, fs=Fs)
Ypic = periodogram(data_pic[:,2], onesided=true, nfft=L, fs=Fs)

#include("/Users/hyzhou/Documents/Computer/Julia/FFT/savitzkyGolay.jl")
#Yhall_fft = savitzky_golay_filter(data_hall[61:end,2],201,1)
#Ypic_fft  = savitzky_golay_filter(data_pic[:,2],201,1)
#=
Yhall_fft = fft(data_hall[121:end,2])
Ypic_fft = fft(data_pic[:,2])

P2_hall = @. abs(Yhall_fft/(L-120))
P1_hall = P2_hall[1:floor(Int,(L-120)/2+1)]
P1_hall[2:end-1] .= 2.0 .* P1_hall[2:end-1]

f_hall = Fs*(0:((L-120)/2))/(L-120)

P2_pic = @. abs(Ypic_fft/L)
P1_pic = P2_pic[1:floor(Int,L/2+1)]
P1_pic[2:end-1] .= 2.0 .* P1_pic[2:end-1]

f_pic = Fs*(0:(L/2))/L
=#
#ax[3].plot(1 ./ f_hall[2:end], P1_hall[2:end], label="Hall MHD")
#ax[3].plot(1 ./ f_pic[2:end], P1_pic[2:end], label="MHD-EPIC")
# Note: this is PSD in linear scale!
ax[3].plot(1 ./ Yhall.freq[1:end], Yhall.power[1:end], label="Hall MHD")
ax[3].plot(1 ./ Ypic.freq[1:end],  Ypic.power[1:end],  label="MHD-EPIC")
ax[3].set_xlabel("Period [s]")
ax[3].set_ylabel("PSD")
ax[3].grid("on")
ax[3].set_xlim(0,150)
#plt.yscale("log")
#plt.xscale("log")
ax[3].legend()
ax[3].minorticks_on()
ax[3].tick_params(which="both", direction="in")
ax[3].annotate("(c)", xy=(-0.03, 1.0), xycoords="axes fraction", fontsize=14)
tight_layout()
#=
fig.savefig(
   "/Users/hyzhou/Documents/research/paper/Ganymede2/test figure/ReconnectionEfficiency_FFT_surfaceIntegral.png",
   dpi=150.0)
=#
@info "Hall CPCP"
println("mean = ", mean(data_hall[:,2]), " ", r_hall_mean/Potential_bk)
println("std  = ", std(data_hall[:,2]), " ", r_hall_std/Potential_bk)
@info "PIC CPCP"
println("mean = ", mean(data_pic[:,2]), " ", r_pic_mean/Potential_bk)
println("std  = ", std(data_pic[:,2]), " ", r_pic_std/Potential_bk)


text:
using OpenQuantumTools

# Define a function to construct an eigendecomposition routine for the
# Hamiltonian. The routine should have the signature: (H, t, lvl) -> (w, v).
# The argument of this function is the cache used by the Hamiltonian object.
function build_user_eigen(u_cache)
    EIGS = function(H, t, lvl)
        println("I am the user defined eigendecomposition routine.")
        w, v = eigen(Hermitian(H(t)))
        w[1:lvl], v[:, 1:lvl]
    end
end

H = DenseHamiltonian([(s)->1-s, (s)->s], [σx, σz], EIGS=build_user_eigen)

eigen_decomp(H, 0.5, lvl=2)

function build_user_eigen(u_cache)
    # note that to keep the unit consistent, the unit of any value inside the routine should be 1/h
    w, v = eigen(Hermitian(2*π*(σx+σz)))
    EIGS = function(H, t, lvl)
        w[1:lvl], v[:, 1:lvl]
    end
end

H = DenseHamiltonian([(s)->1.0], [σx+σz], EIGS=build_user_eigen)

print(eigen_decomp(H, 0.5, lvl=2))
print(eigen_decomp(H, 0.0, lvl=2))

Hd = standard_driver(4, sp=true);
Hp = two_local_term(rand(3), [[1,2],[2,3],[3,4]], 4, sp=true)
H = SparseHamiltonian([(s)->1-s, (s)->s], [Hd, Hp], unit=:ħ)

# the default eigen_decomposition using the dense matrices algorithm
w, v = eigen_decomp(H, 0.1, lvl=4)

using Arpack

function build_user_eigen(u_cache)
    function (H, t, lvl)
        hmat = H(t)
        println("Using sparse matrix algorithm")
        # define all the Arpack routine parameters here
        eigs(hmat, nev = lvl, which=:SR, tol=0.0, maxiter=300)
    end
end

Hd = standard_driver(4, sp=true);
Hp = two_local_term(rand(3), [[1,2],[2,3],[3,4]], 4, sp=true)
H = SparseHamiltonian([(s)->1-s, (s)->s], [Hd, Hp], unit=:ħ, EIGS =build_user_eigen)

eigen_decomp(H, 0.1, lvl=4)


text:
println()
# k = -3
# while k < 10
    # println(k, " = " , bitstring(Float64(k)))
    # global k += 1
# end

# println(bitstring(0.5))

function bin2dec(s)
    x = 0
    for c in s
        x *= 2
        x += Int(c) - Int('0')
    end
    return x
end

function stringbit2num(s)
    bias = 2^10 - 1
    sign = bin2dec(s[1])
    ex = bin2dec(s[2:12]) - bias
    mant = 1 + bin2dec(s[13:end]) / (2^52)
    if sign == 1
        sign = -1
    else
        sign = 1
    end
    return sign * mant * (2^ex)
end

# println(stringbit2xber(bitstring(1)))
bitstring(stringbit2num(1.0))

max_stars_repo_path: II rok/I semestr/ANM/Cwiczenia 01/zad7.jl

max_stars_repo_name: antonitomaszewski/Studia

max_issues_repo_name: antonitomaszewski/Studia

max_forks_repo_name: antonitomaszewski/Studia


text:
export mseis!

function SeisData(U...)
  S = SeisData()
  for i = 1:length(U)
    Y = getindex(U,i)
    if typeof(Y) == SeisChannel
      push!(S, Y)
    elseif typeof(Y) == EventChannel
        push!(S, convert(SeisChannel, Y))
    elseif typeof(Y) == SeisData
      append!(S, Y)
    elseif typeof(Y) == EventTraceData
      append!(S, convert(SeisData, Y))
    elseif typeof(Y) == SeisEvent
      append!(S, convert(SeisData, getfield(Y, :data)))
    else
      @warn(string("Tried to join incompatible type into SeisData at arg ", i, "; skipped."))
    end
  end
  return S
end

"""
    mseis!(S::SeisData, U::SeisData, ...)

Merge multiple SeisData structures at once.

See also: `merge!`
"""
function mseis!(S...)
  U = Union{SeisData, SeisChannel, SeisEvent, EventTraceData, EventChannel}
  L = Int64(length(S))
  (L < 2) && return
  S1 = getindex(S, 1)
  (typeof(S1) == SeisData) || error("Target must be type SeisData!")
  for i = 2:L
    T = typeof(getindex(S, i))
    if (T <: U) == false
      @warn(string("Object of incompatible type passed to wseis at ", i+1, "; skipped!"))
      continue
    end
    if T == SeisData
      append!(S1, getindex(S, i))
    elseif T == EventTraceData
      append!(S1, convert(SeisData, getindex(S, i)))
    elseif T == SeisChannel
      append!(S1, SeisData(getindex(S, i)))
    elseif T == EventChannel
      append!(S1, SeisData(convert(SeisChannel, getindex(S, i))))
    elseif T == SeisEvent
      append!(S1, convert(SeisData, getfield(getindex(S, i), :data)))
    end
  end
  merge!(S1)
  return S1
end


text:
"""
Struct for Brownian Motion

		bmProcess=BrownianMotionVec(σ::num1,μ::num2) where {num1,num2 <: Number}

Where:\n
		σ	=	volatility of the process.
		μ	=	drift of the process.
"""
mutable struct BrownianMotionVec{num <: Number, num1 <: Number, num4 <: Number, numtype <: Number} <: AbstractMonteCarloEngine{numtype}
    σ::num
    μ::Curve{num1, num4}
    function BrownianMotionVec(σ::num, μ::Curve{num1, num4}) where {num <: Number, num1 <: Number, num4 <: Number}
        if σ <= 0
            error("Volatility must be positive")
        else
            zero_typed = zero(num) + zero(num1) + zero(num4)
            return new{num, num1, num4, typeof(zero_typed)}(σ, μ)
        end
    end
end

function BrownianMotion(σ::num, μ::Curve{num1, num4}) where {num <: Number, num1 <: Number, num4 <: Number}
    return BrownianMotionVec(σ, μ)
end

function simulate!(X, mcProcess::BrownianMotionVec, mcBaseData::MonteCarloConfiguration{type1, type2, type3, SerialMode, type5}, T::numb) where {numb <: Number, type1 <: Number, type2 <: Number, type3 <: StandardMC, type5 <: Random.AbstractRNG}
    Nsim = mcBaseData.Nsim
    Nstep = mcBaseData.Nstep
    σ = mcProcess.σ
    μ = mcProcess.μ
    @assert T > 0
    dt = T / Nstep
    stddev_bm = σ * sqrt(dt)
    zero_drift = μ(dt * 0, dt)
    isDualZero = stddev_bm * 0 * zero_drift
    view(X, :, 1) .= isDualZero
    @inbounds for j = 1:Nstep
        tmp_ = μ((j - 1) * dt, dt)
        @inbounds for i = 1:Nsim
            x_i_j = @views X[i, j]
            @views X[i, j+1] = x_i_j + tmp_ + stddev_bm * randn(mcBaseData.rng)
        end
    end

    nothing
end

function simulate!(X, mcProcess::BrownianMotionVec, mcBaseData::MonteCarloConfiguration{type1, type2, type3, SerialMode, type5}, T::numb) where {numb <: Number, type1 <: Number, type2 <: Number, type3 <: AntitheticMC, type5 <: Random.AbstractRNG}
    Nsim = mcBaseData.Nsim
    Nstep = mcBaseData.Nstep
    σ = mcProcess.σ
    μ = mcProcess.μ
    @assert T > 0
    dt = T / Nstep
    stddev_bm = σ * sqrt(dt)
    zero_drift = μ(dt * 0, dt)
    isDualZero = stddev_bm * 0 * zero_drift
    view(X, :, 1) .= isDualZero
    Nsim_2 = div(Nsim, 2)

    @inbounds for j = 1:Nstep
        tmp_ = μ((j - 1) * dt, dt)
        @inbounds for i = 1:Nsim_2
            Z = stddev_bm * randn(mcBaseData.rng)
            X[2*i-1, j+1] = X[2*i-1, j] + tmp_ + Z
            X[2*i, j+1] = X[2*i, j] + tmp_ - Z
        end
    end

    nothing
end