# osgeo.osr module

class osgeo.osr.AreaOfUse(*args)

  Bases: `object`

  Proxy of C++ OSRAreaOfUse class.

  property east_lon_degree

    double

    Type:

      east_lon_degree

  property name

    p.char

    Type:

      name

  property north_lat_degree

    double

    Type:

      north_lat_degree

  property south_lat_degree

    double

    Type:

      south_lat_degree

  property thisown

    The membership flag

  property west_lon_degree

    double

    Type:

      west_lon_degree

class osgeo.osr.CRSInfo(*args)

  Bases: `object`

  Proxy of C++ OSRCRSInfo class.

  property area_name

    p.char

    Type:

      area_name

  property auth_name

    p.char

    Type:

      auth_name

  property bbox_valid

    bool

    Type:

      bbox_valid

  property code

    p.char

    Type:

      code

  property deprecated

    bool

    Type:

      deprecated

  property east_lon_degree

    double

    Type:

      east_lon_degree

  property name

    p.char

    Type:

      name

  property north_lat_degree

    double

    Type:

      north_lat_degree

  property projection_method

    p.char

    Type:

      projection_method

  property south_lat_degree

    double

    Type:

      south_lat_degree

  property thisown

    The membership flag

  property type

    OSRCRSType

    Type:

      type

  property west_lon_degree

    double

    Type:

      west_lon_degree

class osgeo.osr.CoordinateTransformation(*args)

  Bases: `object`

  Proxy of C++ OSRCoordinateTransformationShadow class.

  GetInverse(CoordinateTransformation self) → CoordinateTransformation
  TransformBounds(CoordinateTransformation self, double minx, double miny, double maxx, double maxy, int densify_pts)
  TransformPoint(CoordinateTransformation self, double [3] inout)
  TransformPoint(CoordinateTransformation self, double [4] inout) → None
  TransformPoint(CoordinateTransformation self, double x, double y, double z=0.0) → None
  TransformPoint(CoordinateTransformation self, double x, double y, double z, double t) → None
  TransformPointWithErrorCode(CoordinateTransformation self, double x, double y, double z, double t)
  TransformPoints(CoordinateTransformation self, int nCount)
  property thisown

    The membership flag

class osgeo.osr.CoordinateTransformationOptions(*args)

  Bases: `object`

  Proxy of C++ OGRCoordinateTransformationOptions class.

  SetAreaOfInterest(CoordinateTransformationOptions self, double westLongitudeDeg, double southLatitudeDeg, double eastLongitudeDeg, double northLatitudeDeg) → bool
  SetBallparkAllowed(CoordinateTransformationOptions self, bool allowBallpark) → bool
  SetDesiredAccuracy(CoordinateTransformationOptions self, double accuracy) → bool
  SetOperation(CoordinateTransformationOptions self, char const * operation, bool inverseCT=False) → bool
  property thisown

    The membership flag

osgeo.osr.CreateCoordinateTransformation(SpatialReference src, SpatialReference dst, CoordinateTransformationOptions options=None) → CoordinateTransformation

osgeo.osr.DontUseExceptions()

  Disable exceptions in all GDAL related modules (osgeo.gdal, osgeo.ogr, osgeo.osr, osgeo.gnm). Note: prior to GDAL 3.7, this only affected the calling module

class osgeo.osr.ExceptionMgr(useExceptions=True)

  Bases: `object`

  Context manager to manage Python Exception state for GDAL/OGR/OSR/GNM.

  Separate exception state is maintained for each module (gdal, ogr, etc), and this class appears independently in all of them. This is built in top of calls to the older UseExceptions()/DontUseExceptions() functions.

  Example:

      >>> print(gdal.GetUseExceptions())
      0
      >>> with gdal.ExceptionMgr():
      ...     # Exceptions are now in use
      ...     print(gdal.GetUseExceptions())
      1
      >>>
      >>> # Exception state has now been restored
      >>> print(gdal.GetUseExceptions())
      0

osgeo.osr.GetCRSInfoListFromDatabase(char const * authName)

osgeo.osr.GetPROJAuxDbPaths() → char **

osgeo.osr.GetPROJEnableNetwork() → bool

osgeo.osr.GetPROJSearchPaths() → char **

osgeo.osr.GetPROJVersionMajor() → int

osgeo.osr.GetPROJVersionMicro() → int

osgeo.osr.GetPROJVersionMinor() → int

osgeo.osr.GetUseExceptions() → int

osgeo.osr.GetUserInputAsWKT(char const * name) → OGRErr

osgeo.osr.GetWellKnownGeogCSAsWKT(char const * name) → OGRErr

osgeo.osr.OSRAreaOfUse_east_lon_degree_get(AreaOfUse area) → double

osgeo.osr.OSRAreaOfUse_name_get(AreaOfUse area) → char const *

osgeo.osr.OSRAreaOfUse_north_lat_degree_get(AreaOfUse area) → double

osgeo.osr.OSRAreaOfUse_south_lat_degree_get(AreaOfUse area) → double

osgeo.osr.OSRAreaOfUse_west_lon_degree_get(AreaOfUse area) → double

osgeo.osr.OSRCRSInfo_area_name_get(CRSInfo crsInfo) → char const *

osgeo.osr.OSRCRSInfo_auth_name_get(CRSInfo crsInfo) → char const *

osgeo.osr.OSRCRSInfo_bbox_valid_get(CRSInfo crsInfo) → bool

osgeo.osr.OSRCRSInfo_code_get(CRSInfo crsInfo) → char const *

osgeo.osr.OSRCRSInfo_deprecated_get(CRSInfo crsInfo) → bool

osgeo.osr.OSRCRSInfo_east_lon_degree_get(CRSInfo crsInfo) → double

osgeo.osr.OSRCRSInfo_name_get(CRSInfo crsInfo) → char const *

osgeo.osr.OSRCRSInfo_north_lat_degree_get(CRSInfo crsInfo) → double

osgeo.osr.OSRCRSInfo_projection_method_get(CRSInfo crsInfo) → char const *

osgeo.osr.OSRCRSInfo_south_lat_degree_get(CRSInfo crsInfo) → double

osgeo.osr.OSRCRSInfo_type_get(CRSInfo crsInfo) → OSRCRSType

osgeo.osr.OSRCRSInfo_west_lon_degree_get(CRSInfo crsInfo) → double

osgeo.osr.SetPROJAuxDbPath(char const * utf8_path)

osgeo.osr.SetPROJAuxDbPaths(char ** paths)

osgeo.osr.SetPROJEnableNetwork(bool enabled)

osgeo.osr.SetPROJSearchPath(char const * utf8_path)

osgeo.osr.SetPROJSearchPaths(char ** paths)

class osgeo.osr.SpatialReference(*args, **kwargs)

  Bases: `object`

  Proxy of C++ OSRSpatialReferenceShadow class.

  AddGuessedTOWGS84(SpatialReference self) → OGRErr
  AutoIdentifyEPSG(SpatialReference self) → OGRErr
  Clone(SpatialReference self) → SpatialReference
  CloneGeogCS(SpatialReference self) → SpatialReference
  ConvertToOtherProjection(SpatialReference self, char const * other_projection, char ** options=None) → SpatialReference
  CopyGeogCSFrom(SpatialReference self, SpatialReference rhs) → OGRErr
  DemoteTo2D(SpatialReference self, char const * name=None) → OGRErr
  EPSGTreatsAsLatLong(SpatialReference self) → int
  EPSGTreatsAsNorthingEasting(SpatialReference self) → int
  ExportToERM(SpatialReference self) → OGRErr
  ExportToMICoordSys(SpatialReference self) → OGRErr
  ExportToPCI(SpatialReference self) → OGRErr
  ExportToPROJJSON(SpatialReference self, char ** options=None) → OGRErr
  ExportToPrettyWkt(SpatialReference self, int simplify=0) → OGRErr
  ExportToProj4(SpatialReference self) → OGRErr
  ExportToUSGS(SpatialReference self) → OGRErr
  ExportToWkt(SpatialReference self, char ** options=None) → OGRErr
  ExportToXML(SpatialReference self, char const * dialect="") → OGRErr
  FindMatches(SpatialReference self, char ** options=None)
  GetAngularUnits(SpatialReference self) → double
  GetAngularUnitsName(SpatialReference self) → char const *
  GetAreaOfUse(SpatialReference self) → AreaOfUse
  GetAttrValue(SpatialReference self, char const * name, int child=0) → char const *
  GetAuthorityCode(SpatialReference self, char const * target_key) → char const *
  GetAuthorityName(SpatialReference self, char const * target_key) → char const *
  GetAxesCount(SpatialReference self) → int
  GetAxisMappingStrategy(SpatialReference self) → OSRAxisMappingStrategy
  GetAxisName(SpatialReference self, char const * target_key, int iAxis) → char const *
  GetAxisOrientation(SpatialReference self, char const * target_key, int iAxis) → OGRAxisOrientation
  GetCoordinateEpoch(SpatialReference self) → double
  GetDataAxisToSRSAxisMapping(SpatialReference self)
  GetInvFlattening(SpatialReference self) → double
  GetLinearUnits(SpatialReference self) → double
  GetLinearUnitsName(SpatialReference self) → char const *
  GetName(SpatialReference self) → char const *
  GetNormProjParm(SpatialReference self, char const * name, double default_val=0.0) → double
  GetProjParm(SpatialReference self, char const * name, double default_val=0.0) → double
  GetSemiMajor(SpatialReference self) → double
  GetSemiMinor(SpatialReference self) → double
  GetTOWGS84(SpatialReference self) → OGRErr
  GetTargetLinearUnits(SpatialReference self, char const * target_key) → double
  GetUTMZone(SpatialReference self) → int
  HasTOWGS84(SpatialReference self) → bool
  ImportFromEPSG(SpatialReference self, int arg) → OGRErr
  ImportFromEPSGA(SpatialReference self, int arg) → OGRErr
  ImportFromERM(SpatialReference self, char const * proj, char const * datum, char const * units) → OGRErr
  ImportFromESRI(SpatialReference self, char ** ppszInput) → OGRErr
  ImportFromMICoordSys(SpatialReference self, char const * pszCoordSys) → OGRErr
  ImportFromOzi(SpatialReference self, char const *const * papszLines) → OGRErr
  ImportFromPCI(SpatialReference self, char const * proj, char const * units="METRE", double [17] argin=0) → OGRErr
  ImportFromProj4(SpatialReference self, char * ppszInput) → OGRErr
  ImportFromUSGS(SpatialReference self, long proj_code, long zone=0, double [15] argin=0, long datum_code=0) → OGRErr
  ImportFromUrl(SpatialReference self, char * url) → OGRErr
  ImportFromWkt(SpatialReference self, char ** ppszInput) → OGRErr
  ImportFromXML(SpatialReference self, char const * xmlString) → OGRErr
  IsCompound(SpatialReference self) → int
  IsDerivedGeographic(SpatialReference self) → int
  IsDynamic(SpatialReference self) → bool
  IsGeocentric(SpatialReference self) → int
  IsGeographic(SpatialReference self) → int
  IsLocal(SpatialReference self) → int
  IsProjected(SpatialReference self) → int
  IsSame(SpatialReference self, SpatialReference rhs, char ** options=None) → int
  IsSameGeogCS(SpatialReference self, SpatialReference rhs) → int
  IsSameVertCS(SpatialReference self, SpatialReference rhs) → int
  IsVertical(SpatialReference self) → int
  MorphFromESRI(SpatialReference self) → OGRErr
  MorphToESRI(SpatialReference self) → OGRErr
  PromoteTo3D(SpatialReference self, char const * name=None) → OGRErr
  SetACEA(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) → OGRErr
  SetAE(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetAngularUnits(SpatialReference self, char const * name, double to_radians) → OGRErr
  SetAttrValue(SpatialReference self, char const * name, char const * value) → OGRErr
  SetAuthority(SpatialReference self, char const * pszTargetKey, char const * pszAuthority, int nCode) → OGRErr
  SetAxisMappingStrategy(SpatialReference self, OSRAxisMappingStrategy strategy)
  SetBonne(SpatialReference self, double stdp, double cm, double fe, double fn) → OGRErr
  SetCEA(SpatialReference self, double stdp1, double cm, double fe, double fn) → OGRErr
  SetCS(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetCompoundCS(SpatialReference self, char const * name, SpatialReference horizcs, SpatialReference vertcs) → OGRErr
  SetCoordinateEpoch(SpatialReference self, double coordinateEpoch)
  SetDataAxisToSRSAxisMapping(SpatialReference self, int nList) → OGRErr
  SetEC(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) → OGRErr
  SetEckertIV(SpatialReference self, double cm, double fe, double fn) → OGRErr
  SetEckertVI(SpatialReference self, double cm, double fe, double fn) → OGRErr
  SetEquirectangular(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetEquirectangular2(SpatialReference self, double clat, double clong, double pseudostdparallellat, double fe, double fn) → OGRErr
  SetFromUserInput(SpatialReference self, char const * name) → OGRErr
  SetGEOS(SpatialReference self, double cm, double satelliteheight, double fe, double fn) → OGRErr
  SetGH(SpatialReference self, double cm, double fe, double fn) → OGRErr
  SetGS(SpatialReference self, double cm, double fe, double fn) → OGRErr
  SetGaussSchreiberTMercator(SpatialReference self, double clat, double clong, double sc, double fe, double fn) → OGRErr
  SetGeocCS(SpatialReference self, char const * name="unnamed") → OGRErr
  SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich", double dfPMOffset=0.0, char const * pszUnits="degree", double dfConvertToRadians=0.0174532925199433) → OGRErr
  SetGnomonic(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetHOM(SpatialReference self, double clat, double clong, double azimuth, double recttoskew, double scale, double fe, double fn) → OGRErr
  SetHOM2PNO(SpatialReference self, double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale, double fe, double fn) → OGRErr
  SetIGH(SpatialReference self) → OGRErr
  SetKrovak(SpatialReference self, double clat, double clong, double azimuth, double pseudostdparallellat, double scale, double fe, double fn) → OGRErr
  SetLAEA(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetLCC(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) → OGRErr
  SetLCC1SP(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetLCCB(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) → OGRErr
  SetLinearUnits(SpatialReference self, char const * name, double to_meters) → OGRErr
  SetLinearUnitsAndUpdateParameters(SpatialReference self, char const * name, double to_meters) → OGRErr
  SetLocalCS(SpatialReference self, char const * pszName) → OGRErr
  SetMC(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetMercator(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetMercator2SP(SpatialReference self, double stdp1, double clat, double clong, double fe, double fn) → OGRErr
  SetMollweide(SpatialReference self, double cm, double fe, double fn) → OGRErr
  SetNZMG(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetNormProjParm(SpatialReference self, char const * name, double val) → OGRErr
  SetOS(SpatialReference self, double dfOriginLat, double dfCMeridian, double scale, double fe, double fn) → OGRErr
  SetOrthographic(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetPS(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetPolyconic(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetProjCS(SpatialReference self, char const * name="unnamed") → OGRErr
  SetProjParm(SpatialReference self, char const * name, double val) → OGRErr
  SetProjection(SpatialReference self, char const * arg) → OGRErr
  SetRobinson(SpatialReference self, double clong, double fe, double fn) → OGRErr
  SetSOC(SpatialReference self, double latitudeoforigin, double cm, double fe, double fn) → OGRErr
  SetSinusoidal(SpatialReference self, double clong, double fe, double fn) → OGRErr
  SetStatePlane(SpatialReference self, int zone, int is_nad83=1, char const * unitsname="", double units=0.0) → OGRErr
  SetStereographic(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetTM(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetTMG(SpatialReference self, double clat, double clong, double fe, double fn) → OGRErr
  SetTMSO(SpatialReference self, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetTMVariant(SpatialReference self, char const * pszVariantName, double clat, double clong, double scale, double fe, double fn) → OGRErr
  SetTOWGS84(SpatialReference self, double p1, double p2, double p3, double p4=0.0, double p5=0.0, double p6=0.0, double p7=0.0) → OGRErr
  SetTargetLinearUnits(SpatialReference self, char const * target, char const * name, double to_meters) → OGRErr
  SetUTM(SpatialReference self, int zone, int north=1) → OGRErr
  SetVDG(SpatialReference self, double clong, double fe, double fn) → OGRErr
  SetVertCS(SpatialReference self, char const * VertCSName="unnamed", char const * VertDatumName="unnamed", int VertDatumType=0) → OGRErr
  SetVerticalPerspective(SpatialReference self, double topoOriginLat, double topoOriginLon, double topoOriginHeight, double viewPointHeight, double fe, double fn) → OGRErr
  SetWellKnownGeogCS(SpatialReference self, char const * name) → OGRErr
  StripVertical(SpatialReference self) → OGRErr
  Validate(SpatialReference self) → OGRErr
  property thisown

    The membership flag

osgeo.osr.UseExceptions()

  Enable exceptions in all GDAL related modules (osgeo.gdal, osgeo.ogr, osgeo.osr, osgeo.gnm). Note: prior to GDAL 3.7, this only affected the calling module