# This file was automatically generated by SWIG (https://www.swig.org). # Version 4.2.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Import the low-level C/C++ module if __package__ or "." in __name__: from . import _osr else: import _osr try: import builtins as __builtin__ except ImportError: import __builtin__ def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except __builtin__.Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) def _swig_setattr_nondynamic_instance_variable(set): def set_instance_attr(self, name, value): if name == "this": set(self, name, value) elif name == "thisown": self.this.own(value) elif hasattr(self, name) and isinstance(getattr(type(self), name), property): set(self, name, value) else: raise AttributeError("You cannot add instance attributes to %s" % self) return set_instance_attr def _swig_setattr_nondynamic_class_variable(set): def set_class_attr(cls, name, value): if hasattr(cls, name) and not isinstance(getattr(cls, name), property): set(cls, name, value) else: raise AttributeError("You cannot add class attributes to %s" % cls) return set_class_attr def _swig_add_metaclass(metaclass): """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" def wrapper(cls): return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) return wrapper class _SwigNonDynamicMeta(type): """Meta class to enforce nondynamic attributes (no new attributes) for a class""" __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) SRS_WKT_WGS84_LAT_LONG = _osr.SRS_WKT_WGS84_LAT_LONG SRS_PT_ALBERS_CONIC_EQUAL_AREA = _osr.SRS_PT_ALBERS_CONIC_EQUAL_AREA SRS_PT_AZIMUTHAL_EQUIDISTANT = _osr.SRS_PT_AZIMUTHAL_EQUIDISTANT SRS_PT_CASSINI_SOLDNER = _osr.SRS_PT_CASSINI_SOLDNER SRS_PT_CYLINDRICAL_EQUAL_AREA = _osr.SRS_PT_CYLINDRICAL_EQUAL_AREA SRS_PT_BONNE = _osr.SRS_PT_BONNE SRS_PT_ECKERT_I = _osr.SRS_PT_ECKERT_I SRS_PT_ECKERT_II = _osr.SRS_PT_ECKERT_II SRS_PT_ECKERT_III = _osr.SRS_PT_ECKERT_III SRS_PT_ECKERT_IV = _osr.SRS_PT_ECKERT_IV SRS_PT_ECKERT_V = _osr.SRS_PT_ECKERT_V SRS_PT_ECKERT_VI = _osr.SRS_PT_ECKERT_VI SRS_PT_EQUIDISTANT_CONIC = _osr.SRS_PT_EQUIDISTANT_CONIC SRS_PT_EQUIRECTANGULAR = _osr.SRS_PT_EQUIRECTANGULAR SRS_PT_GALL_STEREOGRAPHIC = _osr.SRS_PT_GALL_STEREOGRAPHIC SRS_PT_GAUSSSCHREIBERTMERCATOR = _osr.SRS_PT_GAUSSSCHREIBERTMERCATOR SRS_PT_GEOSTATIONARY_SATELLITE = _osr.SRS_PT_GEOSTATIONARY_SATELLITE SRS_PT_GOODE_HOMOLOSINE = _osr.SRS_PT_GOODE_HOMOLOSINE SRS_PT_IGH = _osr.SRS_PT_IGH SRS_PT_GNOMONIC = _osr.SRS_PT_GNOMONIC SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER = _osr.SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER SRS_PT_HOTINE_OBLIQUE_MERCATOR = _osr.SRS_PT_HOTINE_OBLIQUE_MERCATOR SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN = _osr.SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN SRS_PT_LABORDE_OBLIQUE_MERCATOR = _osr.SRS_PT_LABORDE_OBLIQUE_MERCATOR SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP = _osr.SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP = _osr.SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM = _osr.SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA = _osr.SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA SRS_PT_MERCATOR_1SP = _osr.SRS_PT_MERCATOR_1SP SRS_PT_MERCATOR_2SP = _osr.SRS_PT_MERCATOR_2SP SRS_PT_MERCATOR_AUXILIARY_SPHERE = _osr.SRS_PT_MERCATOR_AUXILIARY_SPHERE SRS_PT_MILLER_CYLINDRICAL = _osr.SRS_PT_MILLER_CYLINDRICAL SRS_PT_MOLLWEIDE = _osr.SRS_PT_MOLLWEIDE SRS_PT_NEW_ZEALAND_MAP_GRID = _osr.SRS_PT_NEW_ZEALAND_MAP_GRID SRS_PT_OBLIQUE_STEREOGRAPHIC = _osr.SRS_PT_OBLIQUE_STEREOGRAPHIC SRS_PT_ORTHOGRAPHIC = _osr.SRS_PT_ORTHOGRAPHIC SRS_PT_POLAR_STEREOGRAPHIC = _osr.SRS_PT_POLAR_STEREOGRAPHIC SRS_PT_POLYCONIC = _osr.SRS_PT_POLYCONIC SRS_PT_ROBINSON = _osr.SRS_PT_ROBINSON SRS_PT_SINUSOIDAL = _osr.SRS_PT_SINUSOIDAL SRS_PT_STEREOGRAPHIC = _osr.SRS_PT_STEREOGRAPHIC SRS_PT_SWISS_OBLIQUE_CYLINDRICAL = _osr.SRS_PT_SWISS_OBLIQUE_CYLINDRICAL SRS_PT_TRANSVERSE_MERCATOR = _osr.SRS_PT_TRANSVERSE_MERCATOR SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED = _osr.SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED SRS_PT_TRANSVERSE_MERCATOR_MI_21 = _osr.SRS_PT_TRANSVERSE_MERCATOR_MI_21 SRS_PT_TRANSVERSE_MERCATOR_MI_22 = _osr.SRS_PT_TRANSVERSE_MERCATOR_MI_22 SRS_PT_TRANSVERSE_MERCATOR_MI_23 = _osr.SRS_PT_TRANSVERSE_MERCATOR_MI_23 SRS_PT_TRANSVERSE_MERCATOR_MI_24 = _osr.SRS_PT_TRANSVERSE_MERCATOR_MI_24 SRS_PT_TRANSVERSE_MERCATOR_MI_25 = _osr.SRS_PT_TRANSVERSE_MERCATOR_MI_25 SRS_PT_TUNISIA_MINING_GRID = _osr.SRS_PT_TUNISIA_MINING_GRID SRS_PT_TWO_POINT_EQUIDISTANT = _osr.SRS_PT_TWO_POINT_EQUIDISTANT SRS_PT_VANDERGRINTEN = _osr.SRS_PT_VANDERGRINTEN SRS_PT_KROVAK = _osr.SRS_PT_KROVAK SRS_PT_IMW_POLYCONIC = _osr.SRS_PT_IMW_POLYCONIC SRS_PT_WAGNER_I = _osr.SRS_PT_WAGNER_I SRS_PT_WAGNER_II = _osr.SRS_PT_WAGNER_II SRS_PT_WAGNER_III = _osr.SRS_PT_WAGNER_III SRS_PT_WAGNER_IV = _osr.SRS_PT_WAGNER_IV SRS_PT_WAGNER_V = _osr.SRS_PT_WAGNER_V SRS_PT_WAGNER_VI = _osr.SRS_PT_WAGNER_VI SRS_PT_WAGNER_VII = _osr.SRS_PT_WAGNER_VII SRS_PT_QSC = _osr.SRS_PT_QSC SRS_PT_AITOFF = _osr.SRS_PT_AITOFF SRS_PT_WINKEL_I = _osr.SRS_PT_WINKEL_I SRS_PT_WINKEL_II = _osr.SRS_PT_WINKEL_II SRS_PT_WINKEL_TRIPEL = _osr.SRS_PT_WINKEL_TRIPEL SRS_PT_CRASTER_PARABOLIC = _osr.SRS_PT_CRASTER_PARABOLIC SRS_PT_LOXIMUTHAL = _osr.SRS_PT_LOXIMUTHAL SRS_PT_QUARTIC_AUTHALIC = _osr.SRS_PT_QUARTIC_AUTHALIC SRS_PT_SCH = _osr.SRS_PT_SCH SRS_PP_CENTRAL_MERIDIAN = _osr.SRS_PP_CENTRAL_MERIDIAN SRS_PP_SCALE_FACTOR = _osr.SRS_PP_SCALE_FACTOR SRS_PP_STANDARD_PARALLEL_1 = _osr.SRS_PP_STANDARD_PARALLEL_1 SRS_PP_STANDARD_PARALLEL_2 = _osr.SRS_PP_STANDARD_PARALLEL_2 SRS_PP_PSEUDO_STD_PARALLEL_1 = _osr.SRS_PP_PSEUDO_STD_PARALLEL_1 SRS_PP_LONGITUDE_OF_CENTER = _osr.SRS_PP_LONGITUDE_OF_CENTER SRS_PP_LATITUDE_OF_CENTER = _osr.SRS_PP_LATITUDE_OF_CENTER SRS_PP_LONGITUDE_OF_ORIGIN = _osr.SRS_PP_LONGITUDE_OF_ORIGIN SRS_PP_LATITUDE_OF_ORIGIN = _osr.SRS_PP_LATITUDE_OF_ORIGIN SRS_PP_FALSE_EASTING = _osr.SRS_PP_FALSE_EASTING SRS_PP_FALSE_NORTHING = _osr.SRS_PP_FALSE_NORTHING SRS_PP_AZIMUTH = _osr.SRS_PP_AZIMUTH SRS_PP_LONGITUDE_OF_POINT_1 = _osr.SRS_PP_LONGITUDE_OF_POINT_1 SRS_PP_LATITUDE_OF_POINT_1 = _osr.SRS_PP_LATITUDE_OF_POINT_1 SRS_PP_LONGITUDE_OF_POINT_2 = _osr.SRS_PP_LONGITUDE_OF_POINT_2 SRS_PP_LATITUDE_OF_POINT_2 = _osr.SRS_PP_LATITUDE_OF_POINT_2 SRS_PP_LONGITUDE_OF_POINT_3 = _osr.SRS_PP_LONGITUDE_OF_POINT_3 SRS_PP_LATITUDE_OF_POINT_3 = _osr.SRS_PP_LATITUDE_OF_POINT_3 SRS_PP_RECTIFIED_GRID_ANGLE = _osr.SRS_PP_RECTIFIED_GRID_ANGLE SRS_PP_LANDSAT_NUMBER = _osr.SRS_PP_LANDSAT_NUMBER SRS_PP_PATH_NUMBER = _osr.SRS_PP_PATH_NUMBER SRS_PP_PERSPECTIVE_POINT_HEIGHT = _osr.SRS_PP_PERSPECTIVE_POINT_HEIGHT SRS_PP_SATELLITE_HEIGHT = _osr.SRS_PP_SATELLITE_HEIGHT SRS_PP_FIPSZONE = _osr.SRS_PP_FIPSZONE SRS_PP_ZONE = _osr.SRS_PP_ZONE SRS_PP_LATITUDE_OF_1ST_POINT = _osr.SRS_PP_LATITUDE_OF_1ST_POINT SRS_PP_LONGITUDE_OF_1ST_POINT = _osr.SRS_PP_LONGITUDE_OF_1ST_POINT SRS_PP_LATITUDE_OF_2ND_POINT = _osr.SRS_PP_LATITUDE_OF_2ND_POINT SRS_PP_LONGITUDE_OF_2ND_POINT = _osr.SRS_PP_LONGITUDE_OF_2ND_POINT SRS_PP_PEG_POINT_LATITUDE = _osr.SRS_PP_PEG_POINT_LATITUDE SRS_PP_PEG_POINT_LONGITUDE = _osr.SRS_PP_PEG_POINT_LONGITUDE SRS_PP_PEG_POINT_HEADING = _osr.SRS_PP_PEG_POINT_HEADING SRS_PP_PEG_POINT_HEIGHT = _osr.SRS_PP_PEG_POINT_HEIGHT SRS_UL_METER = _osr.SRS_UL_METER SRS_UL_FOOT = _osr.SRS_UL_FOOT SRS_UL_FOOT_CONV = _osr.SRS_UL_FOOT_CONV SRS_UL_US_FOOT = _osr.SRS_UL_US_FOOT SRS_UL_US_FOOT_CONV = _osr.SRS_UL_US_FOOT_CONV SRS_UL_NAUTICAL_MILE = _osr.SRS_UL_NAUTICAL_MILE SRS_UL_NAUTICAL_MILE_CONV = _osr.SRS_UL_NAUTICAL_MILE_CONV SRS_UL_LINK = _osr.SRS_UL_LINK SRS_UL_LINK_CONV = _osr.SRS_UL_LINK_CONV SRS_UL_CHAIN = _osr.SRS_UL_CHAIN SRS_UL_CHAIN_CONV = _osr.SRS_UL_CHAIN_CONV SRS_UL_ROD = _osr.SRS_UL_ROD SRS_UL_ROD_CONV = _osr.SRS_UL_ROD_CONV SRS_UL_LINK_Clarke = _osr.SRS_UL_LINK_Clarke SRS_UL_LINK_Clarke_CONV = _osr.SRS_UL_LINK_Clarke_CONV SRS_UL_KILOMETER = _osr.SRS_UL_KILOMETER SRS_UL_KILOMETER_CONV = _osr.SRS_UL_KILOMETER_CONV SRS_UL_DECIMETER = _osr.SRS_UL_DECIMETER SRS_UL_DECIMETER_CONV = _osr.SRS_UL_DECIMETER_CONV SRS_UL_CENTIMETER = _osr.SRS_UL_CENTIMETER SRS_UL_CENTIMETER_CONV = _osr.SRS_UL_CENTIMETER_CONV SRS_UL_MILLIMETER = _osr.SRS_UL_MILLIMETER SRS_UL_MILLIMETER_CONV = _osr.SRS_UL_MILLIMETER_CONV SRS_UL_INTL_NAUT_MILE = _osr.SRS_UL_INTL_NAUT_MILE SRS_UL_INTL_NAUT_MILE_CONV = _osr.SRS_UL_INTL_NAUT_MILE_CONV SRS_UL_INTL_INCH = _osr.SRS_UL_INTL_INCH SRS_UL_INTL_INCH_CONV = _osr.SRS_UL_INTL_INCH_CONV SRS_UL_INTL_FOOT = _osr.SRS_UL_INTL_FOOT SRS_UL_INTL_FOOT_CONV = _osr.SRS_UL_INTL_FOOT_CONV SRS_UL_INTL_YARD = _osr.SRS_UL_INTL_YARD SRS_UL_INTL_YARD_CONV = _osr.SRS_UL_INTL_YARD_CONV SRS_UL_INTL_STAT_MILE = _osr.SRS_UL_INTL_STAT_MILE SRS_UL_INTL_STAT_MILE_CONV = _osr.SRS_UL_INTL_STAT_MILE_CONV SRS_UL_INTL_FATHOM = _osr.SRS_UL_INTL_FATHOM SRS_UL_INTL_FATHOM_CONV = _osr.SRS_UL_INTL_FATHOM_CONV SRS_UL_INTL_CHAIN = _osr.SRS_UL_INTL_CHAIN SRS_UL_INTL_CHAIN_CONV = _osr.SRS_UL_INTL_CHAIN_CONV SRS_UL_INTL_LINK = _osr.SRS_UL_INTL_LINK SRS_UL_INTL_LINK_CONV = _osr.SRS_UL_INTL_LINK_CONV SRS_UL_US_INCH = _osr.SRS_UL_US_INCH SRS_UL_US_INCH_CONV = _osr.SRS_UL_US_INCH_CONV SRS_UL_US_YARD = _osr.SRS_UL_US_YARD SRS_UL_US_YARD_CONV = _osr.SRS_UL_US_YARD_CONV SRS_UL_US_CHAIN = _osr.SRS_UL_US_CHAIN SRS_UL_US_CHAIN_CONV = _osr.SRS_UL_US_CHAIN_CONV SRS_UL_US_STAT_MILE = _osr.SRS_UL_US_STAT_MILE SRS_UL_US_STAT_MILE_CONV = _osr.SRS_UL_US_STAT_MILE_CONV SRS_UL_INDIAN_YARD = _osr.SRS_UL_INDIAN_YARD SRS_UL_INDIAN_YARD_CONV = _osr.SRS_UL_INDIAN_YARD_CONV SRS_UL_INDIAN_FOOT = _osr.SRS_UL_INDIAN_FOOT SRS_UL_INDIAN_FOOT_CONV = _osr.SRS_UL_INDIAN_FOOT_CONV SRS_UL_INDIAN_CHAIN = _osr.SRS_UL_INDIAN_CHAIN SRS_UL_INDIAN_CHAIN_CONV = _osr.SRS_UL_INDIAN_CHAIN_CONV SRS_UA_DEGREE = _osr.SRS_UA_DEGREE SRS_UA_DEGREE_CONV = _osr.SRS_UA_DEGREE_CONV SRS_UA_RADIAN = _osr.SRS_UA_RADIAN SRS_PM_GREENWICH = _osr.SRS_PM_GREENWICH SRS_DN_NAD27 = _osr.SRS_DN_NAD27 SRS_DN_NAD83 = _osr.SRS_DN_NAD83 SRS_DN_WGS72 = _osr.SRS_DN_WGS72 SRS_DN_WGS84 = _osr.SRS_DN_WGS84 SRS_WGS84_SEMIMAJOR = _osr.SRS_WGS84_SEMIMAJOR SRS_WGS84_INVFLATTENING = _osr.SRS_WGS84_INVFLATTENING OAO_Other = _osr.OAO_Other OAO_North = _osr.OAO_North OAO_South = _osr.OAO_South OAO_East = _osr.OAO_East OAO_West = _osr.OAO_West OAO_Up = _osr.OAO_Up OAO_Down = _osr.OAO_Down OAMS_TRADITIONAL_GIS_ORDER = _osr.OAMS_TRADITIONAL_GIS_ORDER OAMS_AUTHORITY_COMPLIANT = _osr.OAMS_AUTHORITY_COMPLIANT OAMS_CUSTOM = _osr.OAMS_CUSTOM PROJ_ERR_INVALID_OP = _osr.PROJ_ERR_INVALID_OP PROJ_ERR_INVALID_OP_WRONG_SYNTAX = _osr.PROJ_ERR_INVALID_OP_WRONG_SYNTAX PROJ_ERR_INVALID_OP_MISSING_ARG = _osr.PROJ_ERR_INVALID_OP_MISSING_ARG PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE = _osr.PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS = _osr.PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID = _osr.PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID PROJ_ERR_COORD_TRANSFM = _osr.PROJ_ERR_COORD_TRANSFM PROJ_ERR_COORD_TRANSFM_INVALID_COORD = _osr.PROJ_ERR_COORD_TRANSFM_INVALID_COORD PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN = _osr.PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN PROJ_ERR_COORD_TRANSFM_NO_OPERATION = _osr.PROJ_ERR_COORD_TRANSFM_NO_OPERATION PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID = _osr.PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA = _osr.PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA PROJ_ERR_OTHER = _osr.PROJ_ERR_OTHER PROJ_ERR_OTHER_API_MISUSE = _osr.PROJ_ERR_OTHER_API_MISUSE PROJ_ERR_OTHER_NO_INVERSE_OP = _osr.PROJ_ERR_OTHER_NO_INVERSE_OP PROJ_ERR_OTHER_NETWORK_ERROR = _osr.PROJ_ERR_OTHER_NETWORK_ERROR def GetUseExceptions(*args): r"""GetUseExceptions() -> int""" return _osr.GetUseExceptions(*args) def _GetExceptionsLocal(*args): r"""_GetExceptionsLocal() -> int""" return _osr._GetExceptionsLocal(*args) def _SetExceptionsLocal(*args): r"""_SetExceptionsLocal(int bVal)""" return _osr._SetExceptionsLocal(*args) def _UseExceptions(*args): r"""_UseExceptions()""" return _osr._UseExceptions(*args) def _DontUseExceptions(*args): r"""_DontUseExceptions()""" return _osr._DontUseExceptions(*args) def _UserHasSpecifiedIfUsingExceptions(*args): r"""_UserHasSpecifiedIfUsingExceptions() -> int""" return _osr._UserHasSpecifiedIfUsingExceptions(*args) class ExceptionMgr(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 """ def __init__(self, useExceptions=True): """ Save whether or not this context will be using exceptions """ self.requestedUseExceptions = useExceptions def __enter__(self): """ On context entry, save the current GDAL exception state, and set it to the state requested for the context """ self.currentUseExceptions = _GetExceptionsLocal() _SetExceptionsLocal(self.requestedUseExceptions) if ExceptionMgr.__module__ == "osgeo.gdal": try: from . import gdal_array except ImportError: gdal_array = None if gdal_array: gdal_array._SetExceptionsLocal(self.requestedUseExceptions) def __exit__(self, exc_type, exc_val, exc_tb): """ On exit, restore the GDAL/OGR/OSR/GNM exception state which was current on entry to the context """ _SetExceptionsLocal(self.currentUseExceptions) if ExceptionMgr.__module__ == "osgeo.gdal": try: from . import gdal_array except ImportError: gdal_array = None if gdal_array: gdal_array._SetExceptionsLocal(self.currentUseExceptions) def 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""" try: from . import gdal gdal._UseExceptions() except ImportError: pass try: from . import gdal_array gdal_array._UseExceptions() except ImportError: pass try: from . import ogr ogr._UseExceptions() except ImportError: pass try: from . import osr osr._UseExceptions() except ImportError: pass try: from . import gnm gnm._UseExceptions() except ImportError: pass def 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""" try: from . import gdal gdal._DontUseExceptions() except ImportError: pass try: from . import gdal_array gdal_array._DontUseExceptions() except ImportError: pass try: from . import ogr ogr._DontUseExceptions() except ImportError: pass try: from . import osr osr._DontUseExceptions() except ImportError: pass try: from . import gnm gnm._DontUseExceptions() except ImportError: pass hasWarnedAboutUserHasNotSpecifiedIfUsingExceptions = False def _WarnIfUserHasNotSpecifiedIfUsingExceptions(): from . import gdal if not hasattr(gdal, "hasWarnedAboutUserHasNotSpecifiedIfUsingExceptions") and not _UserHasSpecifiedIfUsingExceptions(): gdal.hasWarnedAboutUserHasNotSpecifiedIfUsingExceptions = True import warnings warnings.warn( "Neither osr.UseExceptions() nor osr.DontUseExceptions() has been explicitly called. " + "In GDAL 4.0, exceptions will be enabled by default.", FutureWarning) def GetWellKnownGeogCSAsWKT(*args): r"""GetWellKnownGeogCSAsWKT(char const * name) -> OGRErr""" return _osr.GetWellKnownGeogCSAsWKT(*args) def GetUserInputAsWKT(*args): r"""GetUserInputAsWKT(char const * name) -> OGRErr""" return _osr.GetUserInputAsWKT(*args) class AreaOfUse(object): r"""Proxy of C++ OSRAreaOfUse class.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr west_lon_degree = property(_osr.AreaOfUse_west_lon_degree_get, doc=r"""west_lon_degree : double""") south_lat_degree = property(_osr.AreaOfUse_south_lat_degree_get, doc=r"""south_lat_degree : double""") east_lon_degree = property(_osr.AreaOfUse_east_lon_degree_get, doc=r"""east_lon_degree : double""") north_lat_degree = property(_osr.AreaOfUse_north_lat_degree_get, doc=r"""north_lat_degree : double""") name = property(_osr.AreaOfUse_name_get, doc=r"""name : p.char""") def __init__(self, *args): r"""__init__(AreaOfUse self, double west_lon_degree, double south_lat_degree, double east_lon_degree, double north_lat_degree, char * name) -> AreaOfUse""" _osr.AreaOfUse_swiginit(self, _osr.new_AreaOfUse(*args)) __swig_destroy__ = _osr.delete_AreaOfUse # Register AreaOfUse in _osr: _osr.AreaOfUse_swigregister(AreaOfUse) def OSRAreaOfUse_west_lon_degree_get(*args): r"""OSRAreaOfUse_west_lon_degree_get(AreaOfUse area) -> double""" return _osr.OSRAreaOfUse_west_lon_degree_get(*args) def OSRAreaOfUse_south_lat_degree_get(*args): r"""OSRAreaOfUse_south_lat_degree_get(AreaOfUse area) -> double""" return _osr.OSRAreaOfUse_south_lat_degree_get(*args) def OSRAreaOfUse_east_lon_degree_get(*args): r"""OSRAreaOfUse_east_lon_degree_get(AreaOfUse area) -> double""" return _osr.OSRAreaOfUse_east_lon_degree_get(*args) def OSRAreaOfUse_north_lat_degree_get(*args): r"""OSRAreaOfUse_north_lat_degree_get(AreaOfUse area) -> double""" return _osr.OSRAreaOfUse_north_lat_degree_get(*args) def OSRAreaOfUse_name_get(*args): r"""OSRAreaOfUse_name_get(AreaOfUse area) -> char const *""" return _osr.OSRAreaOfUse_name_get(*args) class SpatialReference(object): r""" Python proxy of an :cpp:class:`OGRSpatialReference`. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, *args, **kwargs): r""" __init__(SpatialReference self, char const * wkt="") -> SpatialReference Python proxy of an :cpp:class:`OGRSpatialReference`. """ _osr.SpatialReference_swiginit(self, _osr.new_SpatialReference(*args, **kwargs)) __swig_destroy__ = _osr.delete_SpatialReference def __str__(self, *args): r"""__str__(SpatialReference self) -> retStringAndCPLFree *""" return _osr.SpatialReference___str__(self, *args) def GetName(self, *args): r""" GetName(SpatialReference self) -> char const * Return the CRS name. See :cpp:func:`OGRSpatialReference::GetName`. Returns ------- str Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetName() 'NAD83 / Vermont (ftUS)' """ return _osr.SpatialReference_GetName(self, *args) def IsSame(self, *args, **kwargs): r""" IsSame(SpatialReference self, SpatialReference rhs, char ** options=None) -> int Determine if two spatial references describe the same system. See :cpp:func:`OGRSpatialReference::IsSame`. Parameters ---------- rhs : SpatialReference options : list/dict Returns ------- int 1 if the spatial references describe the same system, 0 otherwise """ return _osr.SpatialReference_IsSame(self, *args, **kwargs) def IsSameGeogCS(self, *args): r""" IsSameGeogCS(SpatialReference self, SpatialReference rhs) -> int Determine if two spatial references share the same geographic coordinate system. See :cpp:func:`OGRSpatialReference::IsSameGeogCS`. Parameters ---------- rhs : SpatialReference options : list/dict Returns ------- int 1 if the spatial references have the same GeogCS, 0 otherwise """ return _osr.SpatialReference_IsSameGeogCS(self, *args) def IsSameVertCS(self, *args): r""" IsSameVertCS(SpatialReference self, SpatialReference rhs) -> int Determine if two spatial references share the same vertical coordinate system. See :cpp:func:`OGRSpatialReference::IsSameVertCS`. Parameters ---------- rhs : SpatialReference options : list/dict Returns ------- int 1 if the spatial references have the same VertCS, 0 otherwise """ return _osr.SpatialReference_IsSameVertCS(self, *args) def IsGeographic(self, *args): r""" IsGeographic(SpatialReference self) -> int Check if this SRS is a geographic coordinate system. See :cpp:func:`OGRSpatialReference::IsGeographic`. Returns ------- int 1 if the SRS is geographic, 0 otherwise """ return _osr.SpatialReference_IsGeographic(self, *args) def IsDerivedGeographic(self, *args): r""" IsDerivedGeographic(SpatialReference self) -> int Check if this CRS is a derived geographic CRS, such as a rotated long/lat grid. See :cpp:func:`OGRSpatialReference::IsDerivedGeographic`. Returns ------- int 1 if the CRS is derived geographic, 0 otherwise """ return _osr.SpatialReference_IsDerivedGeographic(self, *args) def IsProjected(self, *args): r""" IsProjected(SpatialReference self) -> int Check if this SRS is a projected coordinate system. See :cpp:func:`OGRSpatialReference::IsProjected`. Returns ------- int 1 if the SRS is projected, 0 otherwise """ return _osr.SpatialReference_IsProjected(self, *args) def IsDerivedProjected(self, *args): r"""IsDerivedProjected(SpatialReference self) -> int""" return _osr.SpatialReference_IsDerivedProjected(self, *args) def IsCompound(self, *args): r""" IsCompound(SpatialReference self) -> int Check if this CRS is a compound CRS. See :cpp:func:`OGRSpatialReference::IsCompound`. Returns ------- int 1 if the CRS is compound, 0 otherwise """ return _osr.SpatialReference_IsCompound(self, *args) def IsGeocentric(self, *args): r""" IsGeocentric(SpatialReference self) -> int Check if this SRS is a geocentric coordinate system. See :cpp:func:`OGRSpatialReference::IsGeocentric`. Returns ------- int 1 if the SRS is geocentric, 0 otherwise """ return _osr.SpatialReference_IsGeocentric(self, *args) def IsLocal(self, *args): r""" IsLocal(SpatialReference self) -> int Check if this CRS is a local CRS. See :cpp:func:`OGRSpatialReference::IsLocal`. Returns ------- int 1 if the SRS is local, 0 otherwise """ return _osr.SpatialReference_IsLocal(self, *args) def IsVertical(self, *args): r""" IsVertical(SpatialReference self) -> int Check if this is a vertical coordinate system. See :cpp:func:`OGRSpatialReference::IsVertical`. Returns ------- int 1 if the CRS is vertical, 0 otherwise """ return _osr.SpatialReference_IsVertical(self, *args) def IsDynamic(self, *args): r""" IsDynamic(SpatialReference self) -> bool Check if this CRS is a dynamic coordinate CRS. See :cpp:func:`OGRSpatialReference::IsDynamic`. Returns ------- bool """ return _osr.SpatialReference_IsDynamic(self, *args) def HasPointMotionOperation(self, *args): r""" HasPointMotionOperation(SpatialReference self) -> bool Check if a CRS has an associated point motion operation. See :cpp:func:`OGRSpatialReference::HasPointMotionOperation`. Returns ------- bool """ return _osr.SpatialReference_HasPointMotionOperation(self, *args) def GetCoordinateEpoch(self, *args): r""" GetCoordinateEpoch(SpatialReference self) -> double Return the coordinate epoch as a decimal year. See :cpp:func:`OGRSpatialReference::GetCoordinateEpoch`. Returns ------- float coordinate epoch as a decimal year, or 0 if not set/relevant """ return _osr.SpatialReference_GetCoordinateEpoch(self, *args) def SetCoordinateEpoch(self, *args): r"""SetCoordinateEpoch(SpatialReference self, double coordinateEpoch)""" return _osr.SpatialReference_SetCoordinateEpoch(self, *args) def EPSGTreatsAsLatLong(self, *args): r"""EPSGTreatsAsLatLong(SpatialReference self) -> int""" return _osr.SpatialReference_EPSGTreatsAsLatLong(self, *args) def EPSGTreatsAsNorthingEasting(self, *args): r"""EPSGTreatsAsNorthingEasting(SpatialReference self) -> int""" return _osr.SpatialReference_EPSGTreatsAsNorthingEasting(self, *args) def SetAuthority(self, *args): r"""SetAuthority(SpatialReference self, char const * pszTargetKey, char const * pszAuthority, int nCode) -> OGRErr""" return _osr.SpatialReference_SetAuthority(self, *args) def GetAttrValue(self, *args): r""" GetAttrValue(SpatialReference self, char const * name, int child=0) -> char const * Fetch indicated attribute of named node. See :cpp:func:`OGRSpatialReference::GetAttrValue`. Parameters ---------- name : str tree node to look for (case insensitive) child : int, default = 0 0-indexed child of the node Returns ------- str Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetAttrValue('UNIT', 0) 'US survey foot' """ return _osr.SpatialReference_GetAttrValue(self, *args) def SetAttrValue(self, *args): r"""SetAttrValue(SpatialReference self, char const * name, char const * value) -> OGRErr""" return _osr.SpatialReference_SetAttrValue(self, *args) def SetAngularUnits(self, *args): r"""SetAngularUnits(SpatialReference self, char const * name, double to_radians) -> OGRErr""" return _osr.SpatialReference_SetAngularUnits(self, *args) def GetAngularUnits(self, *args): r""" GetAngularUnits(SpatialReference self) -> double Fetch conversion between angular geographic coordinate system units and radians. See :cpp:func:`OGRSpatialReference::GetAngularUnits`. Returns ------- float Value to multiply angular distances by to transform them to radians. Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) 0 >>> srs.GetAngularUnits() 0.017453292519943295 """ return _osr.SpatialReference_GetAngularUnits(self, *args) def GetAngularUnitsName(self, *args): r""" GetAngularUnitsName(SpatialReference self) -> char const * Fetch angular geographic coordinate system units. See :cpp:func:`OGRSpatialReference::GetAngularUnits`. Returns ------- str Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) 0 >>> srs.GetAngularUnitsName() 'degree' """ return _osr.SpatialReference_GetAngularUnitsName(self, *args) def SetTargetLinearUnits(self, *args): r"""SetTargetLinearUnits(SpatialReference self, char const * target, char const * name, double to_meters) -> OGRErr""" return _osr.SpatialReference_SetTargetLinearUnits(self, *args) def SetLinearUnits(self, *args): r"""SetLinearUnits(SpatialReference self, char const * name, double to_meters) -> OGRErr""" return _osr.SpatialReference_SetLinearUnits(self, *args) def SetLinearUnitsAndUpdateParameters(self, *args): r"""SetLinearUnitsAndUpdateParameters(SpatialReference self, char const * name, double to_meters) -> OGRErr""" return _osr.SpatialReference_SetLinearUnitsAndUpdateParameters(self, *args) def GetTargetLinearUnits(self, *args): r""" GetTargetLinearUnits(SpatialReference self, char const * target_key) -> double Fetch linear units for a target. See :cpp:func:`OGRSpatialReference::GetTargetLinearUnits`. Parameters ---------- target_key : str key to look un, such as 'PROJCS' or 'VERT_CS' Returns ------- double """ return _osr.SpatialReference_GetTargetLinearUnits(self, *args) def GetLinearUnits(self, *args): r""" GetLinearUnits(SpatialReference self) -> double Fetch the conversion between linear projection units and meters. See :cpp:func:`OGRSpatialReference::GetLinearUnits`. Returns ------- float Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetLinearUnits() 0.30480060960121924 """ return _osr.SpatialReference_GetLinearUnits(self, *args) def GetLinearUnitsName(self, *args): r""" GetLinearUnitsName(SpatialReference self) -> char const * Fetch the name of the linear projection units. See :cpp:func:`OGRSpatialReference::GetLinearUnits`. Returns ------- str Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetLinearUnitsName() 'US survey foot' """ return _osr.SpatialReference_GetLinearUnitsName(self, *args) def GetAuthorityCode(self, *args): r""" GetAuthorityCode(SpatialReference self, char const * target_key) -> char const * Get the authority code for a node. See :cpp:func:`OGRSpatialReference::GetAuthorityCode`. Parameters ---------- target_key : str the partial or complete path to the node to get an authority from (e.g., 'PROJCS', 'GEOGCS' or ``None`` to get an authority code on the root element) Returns ------- str or ``None`` on failure Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) 0 >>> srs.GetAuthorityName('DATUM') 'EPSG' >>> srs.GetAuthorityCode('DATUM') '6326' >>> srs.GetAuthorityCode(None) '4326' """ return _osr.SpatialReference_GetAuthorityCode(self, *args) def GetAuthorityName(self, *args): r""" GetAuthorityName(SpatialReference self, char const * target_key) -> char const * Get the authority name for a node. See :cpp:func:`OGRSpatialReference::GetAuthorityName`. Parameters ---------- target_key : str the partial or complete path to the node to get an authority from (e.g., 'PROJCS', 'GEOGCS' or ``None`` to get an authority name on the root element) Returns ------- str """ return _osr.SpatialReference_GetAuthorityName(self, *args) def GetAreaOfUse(self, *args): r""" GetAreaOfUse(SpatialReference self) -> AreaOfUse Return the area of use of the SRS. See :cpp:func:`OGRSpatialReference::GetAreaOfUse`. Returns ------- AreaOfUse object providing a description of the area of use as well as bounding parallels / meridians Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> aou = vt_sp.GetAreaOfUse() >>> aou.name 'United States (USA) - Vermont - counties of Addison; Bennington; Caledonia; Chittenden; Essex; Franklin; Grand Isle; Lamoille; Orange; Orleans; Rutland; Washington; Windham; Windsor.' >>> aou.west_lon_degree, aou.south_lat_degree, aou.east_lon_degree, aou.north_lat_degree (-73.44, 42.72, -71.5, 45.03) """ return _osr.SpatialReference_GetAreaOfUse(self, *args) def GetAxisName(self, *args): r""" GetAxisName(SpatialReference self, char const * target_key, int iAxis) -> char const * Fetch an axis description. See :cpp:func:`OGRSpatialReference::GetAxis`. Parameters ---------- target_key : str The portion of the coordinate system, either 'GEOGCS' or 'PROJCS' iAxis : int The 0-based index of the axis to fetch Returns ------- str Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4979) 0 >>> for i in range(3): ... srs.GetAxisName('GEOGCS', i) ... 'Geodetic latitude' 'Geodetic longitude' 'Ellipsoidal height' """ return _osr.SpatialReference_GetAxisName(self, *args) def GetAxesCount(self, *args): r""" GetAxesCount(SpatialReference self) -> int Return the number of axes of the coordinate system of the CRS. See :cpp:func:`OGRSpatialReference::GetAxesCount`. Returns ------- int Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) 0 >>> srs.GetAxesCount() 2 >>> srs.ImportFromEPSG(4979) 0 >>> srs.GetAxesCount() 3 """ return _osr.SpatialReference_GetAxesCount(self, *args) def GetAxisOrientation(self, *args): r""" GetAxisOrientation(SpatialReference self, char const * target_key, int iAxis) -> OGRAxisOrientation Fetch an axis orientation. See :cpp:func:`OGRSpatialReference::GetAxis`. Parameters ---------- target_key : str The portion of the coordinate system, either 'GEOGCS' or 'PROJCS' iAxis : int The 0-based index of the axis to fetch Returns ------- int Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4979) 0 >>> srs.GetAxisOrientation('GEOGCS', 0) == osr.OAO_North True >>> srs.GetAxisOrientation('GEOGCS', 1) == osr.OAO_East True >>> srs.GetAxisOrientation('GEOGCS', 2) == osr.OAO_Up True """ return _osr.SpatialReference_GetAxisOrientation(self, *args) def GetAxisMappingStrategy(self, *args): r""" GetAxisMappingStrategy(SpatialReference self) -> OSRAxisMappingStrategy Return the data axis to CRS axis mapping strategy: - :py:const:`OAMS_TRADITIONAL_GIS_ORDER` means that for geographic CRS with lag/long order, the data will still be long/lat ordered. Similarly for a projected CRS with northing/easting order, the data will still be easting/northing ordered. - :py:const:`OAMS_AUTHORITY_COMPLIANT` means that the data axis will be identical to the CRS axis. - :py:const:`OAMS_CUSTOM` means that the ordering is defined with :py:meth:`SetDataAxisToSRSAxisMapping`. See :cpp:func:`OGRSpatialReference::GetAxisMappingStrategy`. Returns ------- int """ return _osr.SpatialReference_GetAxisMappingStrategy(self, *args) def SetAxisMappingStrategy(self, *args): r"""SetAxisMappingStrategy(SpatialReference self, OSRAxisMappingStrategy strategy)""" return _osr.SpatialReference_SetAxisMappingStrategy(self, *args) def GetDataAxisToSRSAxisMapping(self, *args): r""" GetDataAxisToSRSAxisMapping(SpatialReference self) Return the data axis to SRS axis mapping. See :cpp:func:`OGRSpatialReference::GetDataAxisToSRSAxisMapping`. Returns ------- tuple """ return _osr.SpatialReference_GetDataAxisToSRSAxisMapping(self, *args) def SetDataAxisToSRSAxisMapping(self, *args): r"""SetDataAxisToSRSAxisMapping(SpatialReference self, int nList) -> OGRErr""" return _osr.SpatialReference_SetDataAxisToSRSAxisMapping(self, *args) def SetUTM(self, *args): r"""SetUTM(SpatialReference self, int zone, int north=1) -> OGRErr""" return _osr.SpatialReference_SetUTM(self, *args) def GetUTMZone(self, *args): r""" GetUTMZone(SpatialReference self) -> int Get UTM zone. See :cpp:func:`OGRSpatialReference::GetUTMZone`. Returns ------- int UTM zone number. Negative in the southern hemisphere and positive in the northern hemisphere. If the SRS is not UTM, zero will be returned. """ return _osr.SpatialReference_GetUTMZone(self, *args) def SetStatePlane(self, *args): r"""SetStatePlane(SpatialReference self, int zone, int is_nad83=1, char const * unitsname="", double units=0.0) -> OGRErr""" return _osr.SpatialReference_SetStatePlane(self, *args) def AutoIdentifyEPSG(self, *args): r""" AutoIdentifyEPSG(SpatialReference self) -> OGRErr Add an EPSG authority code to the CRS where an aspect of the coordinate system can be easily and safely corresponded with an EPSG identifier. See :cpp:func:`OGRSpatialReference::AutoIdentifyEPSG`. Returns ------- int :py:const:`OGRERR_NONE` or :py:const:`OGRERR_UNSUPPORTED_SRS`. """ return _osr.SpatialReference_AutoIdentifyEPSG(self, *args) def FindMatches(self, *args): r"""FindMatches(SpatialReference self, char ** options=None)""" return _osr.SpatialReference_FindMatches(self, *args) def SetProjection(self, *args): r"""SetProjection(SpatialReference self, char const * arg) -> OGRErr""" return _osr.SpatialReference_SetProjection(self, *args) def SetProjParm(self, *args): r"""SetProjParm(SpatialReference self, char const * name, double val) -> OGRErr""" return _osr.SpatialReference_SetProjParm(self, *args) def GetProjParm(self, *args): r""" GetProjParm(SpatialReference self, char const * name, double default_val=0.0) -> double Fetch a projection parameter value. See :cpp:func:`OGRSpatialReference::GetProjParm`. Parameters ---------- name : str parameter name, available as constants prefixed with `SRS_PP`. default_val : float, default = 0.0 value to return if this parameter doesn't exist Returns ------- float Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetProjParm(osr.SRS_PP_FALSE_EASTING) 1640416.6667 >>> vt_sp.GetProjParm(osr.SRS_PP_FALSE_NORTHING) 0.0 """ return _osr.SpatialReference_GetProjParm(self, *args) def SetNormProjParm(self, *args): r"""SetNormProjParm(SpatialReference self, char const * name, double val) -> OGRErr""" return _osr.SpatialReference_SetNormProjParm(self, *args) def GetNormProjParm(self, *args): r""" GetNormProjParm(SpatialReference self, char const * name, double default_val=0.0) -> double Fetch a normalized projection parameter value. This method is the same as :py:meth:`GetProjParm` except that the value of the parameter is normalized into degrees or meters depending on whether it is linear or angular. See :cpp:func:`OGRSpatialReference::GetNormProjParm`. Parameters ---------- name : str parameter name, available as constants prefixed with `SRS_PP`. default_val : float, default = 0.0 value to return if this parameter doesn't exist Returns ------- float Examples -------- >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> vt_sp.GetProjParm(osr.SRS_PP_FALSE_EASTING) 1640416.6667 >>> vt_sp.GetNormProjParm(osr.SRS_PP_FALSE_EASTING) 500000.0000101601 """ return _osr.SpatialReference_GetNormProjParm(self, *args) def GetSemiMajor(self, *args): r""" GetSemiMajor(SpatialReference self) -> double Get spheroid semi major axis (in meters starting with GDAL 3.0) See :cpp:func:`OGRSpatialReference::GetSemiMajor`. Returns ------- float semi-major axis, or :py:const:`SRS_WGS84_SEMIMAJOR` if it cannot be found. """ return _osr.SpatialReference_GetSemiMajor(self, *args) def GetSemiMinor(self, *args): r""" GetSemiMinor(SpatialReference self) -> double Get spheroid semi minor axis. See :cpp:func:`OGRSpatialReference::GetSemiMinor`. Returns ------- float semi-minor axis, or :py:const:`SRS_WGS84_SEMIMINOR` if it cannot be found. """ return _osr.SpatialReference_GetSemiMinor(self, *args) def GetInvFlattening(self, *args): r""" GetInvFlattening(SpatialReference self) -> double Get the spheroid inverse flattening. See :cpp:func:`OGRSpatialReference::GetInvFlattening`. Returns ------- float Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) # WGS84 0 >>> srs.GetInvFlattening() 298.257223563 >>> srs.ImportFromEPSG(4269) # NAD83 0 >>> srs.GetInvFlattening() 298.257222101 """ return _osr.SpatialReference_GetInvFlattening(self, *args) def SetACEA(self, *args, **kwargs): r"""SetACEA(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetACEA(self, *args, **kwargs) def SetAE(self, *args, **kwargs): r"""SetAE(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetAE(self, *args, **kwargs) def SetBonne(self, *args, **kwargs): r"""SetBonne(SpatialReference self, double stdp, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetBonne(self, *args, **kwargs) def SetCEA(self, *args, **kwargs): r"""SetCEA(SpatialReference self, double stdp1, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetCEA(self, *args, **kwargs) def SetCS(self, *args, **kwargs): r"""SetCS(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetCS(self, *args, **kwargs) def SetEC(self, *args, **kwargs): r"""SetEC(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetEC(self, *args, **kwargs) def SetEckertIV(self, *args, **kwargs): r"""SetEckertIV(SpatialReference self, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetEckertIV(self, *args, **kwargs) def SetEckertVI(self, *args, **kwargs): r"""SetEckertVI(SpatialReference self, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetEckertVI(self, *args, **kwargs) def SetEquirectangular(self, *args, **kwargs): r"""SetEquirectangular(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetEquirectangular(self, *args, **kwargs) def SetEquirectangular2(self, *args, **kwargs): r"""SetEquirectangular2(SpatialReference self, double clat, double clong, double pseudostdparallellat, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetEquirectangular2(self, *args, **kwargs) def SetGaussSchreiberTMercator(self, *args, **kwargs): r"""SetGaussSchreiberTMercator(SpatialReference self, double clat, double clong, double sc, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetGaussSchreiberTMercator(self, *args, **kwargs) def SetGS(self, *args, **kwargs): r"""SetGS(SpatialReference self, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetGS(self, *args, **kwargs) def SetGH(self, *args, **kwargs): r"""SetGH(SpatialReference self, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetGH(self, *args, **kwargs) def SetIGH(self, *args): r"""SetIGH(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_SetIGH(self, *args) def SetGEOS(self, *args, **kwargs): r"""SetGEOS(SpatialReference self, double cm, double satelliteheight, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetGEOS(self, *args, **kwargs) def SetGnomonic(self, *args, **kwargs): r"""SetGnomonic(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetGnomonic(self, *args, **kwargs) def SetHOM(self, *args, **kwargs): r"""SetHOM(SpatialReference self, double clat, double clong, double azimuth, double recttoskew, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetHOM(self, *args, **kwargs) def SetHOM2PNO(self, *args, **kwargs): r"""SetHOM2PNO(SpatialReference self, double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetHOM2PNO(self, *args, **kwargs) def SetKrovak(self, *args, **kwargs): r"""SetKrovak(SpatialReference self, double clat, double clong, double azimuth, double pseudostdparallellat, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetKrovak(self, *args, **kwargs) def SetLAEA(self, *args, **kwargs): r"""SetLAEA(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetLAEA(self, *args, **kwargs) def SetLCC(self, *args, **kwargs): r"""SetLCC(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetLCC(self, *args, **kwargs) def SetLCC1SP(self, *args, **kwargs): r"""SetLCC1SP(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetLCC1SP(self, *args, **kwargs) def SetLCCB(self, *args, **kwargs): r"""SetLCCB(SpatialReference self, double stdp1, double stdp2, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetLCCB(self, *args, **kwargs) def SetMC(self, *args, **kwargs): r"""SetMC(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetMC(self, *args, **kwargs) def SetMercator(self, *args, **kwargs): r"""SetMercator(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetMercator(self, *args, **kwargs) def SetMercator2SP(self, *args, **kwargs): r"""SetMercator2SP(SpatialReference self, double stdp1, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetMercator2SP(self, *args, **kwargs) def SetMollweide(self, *args, **kwargs): r"""SetMollweide(SpatialReference self, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetMollweide(self, *args, **kwargs) def SetNZMG(self, *args, **kwargs): r"""SetNZMG(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetNZMG(self, *args, **kwargs) def SetOS(self, *args, **kwargs): r"""SetOS(SpatialReference self, double dfOriginLat, double dfCMeridian, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetOS(self, *args, **kwargs) def SetOrthographic(self, *args, **kwargs): r"""SetOrthographic(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetOrthographic(self, *args, **kwargs) def SetPolyconic(self, *args, **kwargs): r"""SetPolyconic(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetPolyconic(self, *args, **kwargs) def SetPS(self, *args, **kwargs): r"""SetPS(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetPS(self, *args, **kwargs) def SetRobinson(self, *args, **kwargs): r"""SetRobinson(SpatialReference self, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetRobinson(self, *args, **kwargs) def SetSinusoidal(self, *args, **kwargs): r"""SetSinusoidal(SpatialReference self, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetSinusoidal(self, *args, **kwargs) def SetStereographic(self, *args, **kwargs): r"""SetStereographic(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetStereographic(self, *args, **kwargs) def SetSOC(self, *args, **kwargs): r"""SetSOC(SpatialReference self, double latitudeoforigin, double cm, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetSOC(self, *args, **kwargs) def SetTM(self, *args, **kwargs): r"""SetTM(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetTM(self, *args, **kwargs) def SetTMVariant(self, *args, **kwargs): r"""SetTMVariant(SpatialReference self, char const * pszVariantName, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetTMVariant(self, *args, **kwargs) def SetTMG(self, *args, **kwargs): r"""SetTMG(SpatialReference self, double clat, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetTMG(self, *args, **kwargs) def SetTMSO(self, *args, **kwargs): r"""SetTMSO(SpatialReference self, double clat, double clong, double scale, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetTMSO(self, *args, **kwargs) def SetVDG(self, *args, **kwargs): r"""SetVDG(SpatialReference self, double clong, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetVDG(self, *args, **kwargs) def SetVerticalPerspective(self, *args, **kwargs): r"""SetVerticalPerspective(SpatialReference self, double topoOriginLat, double topoOriginLon, double topoOriginHeight, double viewPointHeight, double fe, double fn) -> OGRErr""" return _osr.SpatialReference_SetVerticalPerspective(self, *args, **kwargs) def SetWellKnownGeogCS(self, *args): r"""SetWellKnownGeogCS(SpatialReference self, char const * name) -> OGRErr""" return _osr.SpatialReference_SetWellKnownGeogCS(self, *args) def SetFromUserInput(self, *args, **kwargs): r"""SetFromUserInput(SpatialReference self, char const * name, char ** options=None) -> OGRErr""" return _osr.SpatialReference_SetFromUserInput(self, *args, **kwargs) def CopyGeogCSFrom(self, *args): r"""CopyGeogCSFrom(SpatialReference self, SpatialReference rhs) -> OGRErr""" return _osr.SpatialReference_CopyGeogCSFrom(self, *args) def SetTOWGS84(self, *args): r"""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""" return _osr.SpatialReference_SetTOWGS84(self, *args) def HasTOWGS84(self, *args): r""" HasTOWGS84(SpatialReference self) -> bool Return whether the SRS has a TOWGS84 parameter. See :cpp:func:`OGRSpatialReference::GetTOWGS84`. Returns ------- bool """ return _osr.SpatialReference_HasTOWGS84(self, *args) def GetTOWGS84(self, *args): r""" GetTOWGS84(SpatialReference self) -> OGRErr Fetch TOWGS84 parameter, if available. See :cpp:func:`OGRSpatialReference::GetTOWGS84`. Returns ------- tuple """ return _osr.SpatialReference_GetTOWGS84(self, *args) def AddGuessedTOWGS84(self, *args): r"""AddGuessedTOWGS84(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_AddGuessedTOWGS84(self, *args) def SetLocalCS(self, *args): r"""SetLocalCS(SpatialReference self, char const * pszName) -> OGRErr""" return _osr.SpatialReference_SetLocalCS(self, *args) def SetGeogCS(self, *args): r"""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""" return _osr.SpatialReference_SetGeogCS(self, *args) def SetProjCS(self, *args): r"""SetProjCS(SpatialReference self, char const * name="unnamed") -> OGRErr""" return _osr.SpatialReference_SetProjCS(self, *args) def SetGeocCS(self, *args): r"""SetGeocCS(SpatialReference self, char const * name="unnamed") -> OGRErr""" return _osr.SpatialReference_SetGeocCS(self, *args) def SetVertCS(self, *args): r"""SetVertCS(SpatialReference self, char const * VertCSName="unnamed", char const * VertDatumName="unnamed", int VertDatumType=0) -> OGRErr""" return _osr.SpatialReference_SetVertCS(self, *args) def SetCompoundCS(self, *args): r"""SetCompoundCS(SpatialReference self, char const * name, SpatialReference horizcs, SpatialReference vertcs) -> OGRErr""" return _osr.SpatialReference_SetCompoundCS(self, *args) def ImportFromWkt(self, *args): r""" ImportFromWkt(SpatialReference self, char ** ppszInput) -> OGRErr Import from WKT string. See :cpp:func:`OGRSpatialReference::importFromWkt`. Parameters ---------- ppszInput : str WKT string Returns ------- int :py:const:`OGRERR_NONE` if import succeeds, or :py:const:`OGRERR_CORRUPT_DATA` if it fails for any reason. """ return _osr.SpatialReference_ImportFromWkt(self, *args) def ImportFromProj4(self, *args): r""" ImportFromProj4(SpatialReference self, char * ppszInput) -> OGRErr Initialize SRS based on PROJ coordinate string. See :cpp:func:`OGRSpatialReference::importFromProj4`. Parameters ---------- ppszInput : str PROJ coordinate string Returns ------- int :py:const:`OGRERR_NONE` on success, or :py:const:`OGRERR_CORRUPT_DATA` on failure Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromProj4('+proj=utm +zone=18 +datum=WGS84') 0 """ return _osr.SpatialReference_ImportFromProj4(self, *args) def ImportFromUrl(self, *args): r""" ImportFromUrl(SpatialReference self, char * url) -> OGRErr Initialize SRS based on a URL. This method will download the spatial reference at a given URL and feed it into :py:meth:`SetFromUserInput` for you. See :cpp:func:`OGRSpatialReference::importFromUrl`. Parameters ---------- url : str Returns ------- int :py:const:`OGRERR_NONE` on success, or an error code on failure """ return _osr.SpatialReference_ImportFromUrl(self, *args) def ImportFromESRI(self, *args): r"""ImportFromESRI(SpatialReference self, char ** ppszInput) -> OGRErr""" return _osr.SpatialReference_ImportFromESRI(self, *args) def ImportFromEPSG(self, *args): r""" ImportFromEPSG(SpatialReference self, int arg) -> OGRErr Initialize SRS based on EPSG geographic, projected or vertical CRS code. Since GDAL 3.0, this method is identical to :py:meth:`ImportFromEPSGA`. See :cpp:func:`OGRSpatialReference::importFromEPSG`. Parameters ---------- arg : int EPSG code to search in PROJ database Returns ------- int :py:const:`OGRERR_NONE` on success, or an error code on failure Examples -------- >>> srs = osr.SpatialReference() >>> srs.ImportFromEPSG(4326) 0 """ return _osr.SpatialReference_ImportFromEPSG(self, *args) def ImportFromEPSGA(self, *args): r""" ImportFromEPSGA(SpatialReference self, int arg) -> OGRErr Initialize SRS based on EPSG geographic, projected or vertical CRS code. Since GDAL 3.0, this method is identical to :py:meth:`ImportFromEPSG`. See :cpp:func:`OGRSpatialReference::importFromEPSGA`. Parameters ---------- arg : int EPSG code to search in PROJ database Returns ------- int :py:const:`OGRERR_NONE` on success, or an error code on failure """ return _osr.SpatialReference_ImportFromEPSGA(self, *args) def ImportFromPCI(self, *args): r"""ImportFromPCI(SpatialReference self, char const * proj, char const * units="METRE", double [17] argin=0) -> OGRErr""" return _osr.SpatialReference_ImportFromPCI(self, *args) def ImportFromUSGS(self, *args): r"""ImportFromUSGS(SpatialReference self, long proj_code, long zone=0, double [15] argin=0, long datum_code=0) -> OGRErr""" return _osr.SpatialReference_ImportFromUSGS(self, *args) def ImportFromXML(self, *args): r"""ImportFromXML(SpatialReference self, char const * xmlString) -> OGRErr""" return _osr.SpatialReference_ImportFromXML(self, *args) def ImportFromERM(self, *args): r"""ImportFromERM(SpatialReference self, char const * proj, char const * datum, char const * units) -> OGRErr""" return _osr.SpatialReference_ImportFromERM(self, *args) def ImportFromMICoordSys(self, *args): r"""ImportFromMICoordSys(SpatialReference self, char const * pszCoordSys) -> OGRErr""" return _osr.SpatialReference_ImportFromMICoordSys(self, *args) def ImportFromOzi(self, *args): r"""ImportFromOzi(SpatialReference self, char const *const * papszLines) -> OGRErr""" return _osr.SpatialReference_ImportFromOzi(self, *args) def ImportFromCF1(self, keyValues, units = ""): """ Import a CRS from netCDF CF-1 definitions. http://cfconventions.org/cf-conventions/cf-conventions.html#appendix-grid-mappings """ import copy keyValues = copy.deepcopy(keyValues) for key in keyValues: val = keyValues[key] if isinstance(val, list): val = ','.join(["%.18g" % x for x in val]) keyValues[key] = val return _osr.SpatialReference_ImportFromCF1(self, keyValues, units) def ExportToWkt(self, *args): r""" ExportToWkt(SpatialReference self, char ** options=None) -> OGRErr Export this SRS into WKT 1 format. See :cpp:func:`OGRSpatialReference::exportToWkt`. Returns ------- str See Also -------- :py:meth:`ExportToPrettyWkt` """ return _osr.SpatialReference_ExportToWkt(self, *args) def ExportToPrettyWkt(self, *args): r""" ExportToPrettyWkt(SpatialReference self, int simplify=0) -> OGRErr Convert this SRS into a nicely formatted WKT 1 string for display to a person. See :cpp:func:`OGRSpatialReference::exportToPrettyWkt`. Parameters ---------- simplify : bool, default = False Returns ------- str """ return _osr.SpatialReference_ExportToPrettyWkt(self, *args) def ExportToPROJJSON(self, *args): r""" ExportToPROJJSON(SpatialReference self, char ** options=None) -> OGRErr Export this SRS in `PROJJSON `_ format. See :cpp:func:`OGRSpatialReference::exportToPROJJSON`. Parameters ---------- options : list/dict Options to control the format of the output. See :cpp:func:`OGRSpatialReference::ExportToPROJJSON`. Returns ------- str """ return _osr.SpatialReference_ExportToPROJJSON(self, *args) def ExportToProj4(self, *args): r""" ExportToProj4(SpatialReference self) -> OGRErr Export this SRS to PROJ.4 legacy format. .. warning:: Use of this function is discouraged. See :cpp:func:`OGRSpatialReference::exportToProj4`. Returns ------- str """ return _osr.SpatialReference_ExportToProj4(self, *args) def ExportToPCI(self, *args): r"""ExportToPCI(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_ExportToPCI(self, *args) def ExportToUSGS(self, *args): r"""ExportToUSGS(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_ExportToUSGS(self, *args) def ExportToERM(self, *args): r"""ExportToERM(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_ExportToERM(self, *args) def ExportToXML(self, *args): r"""ExportToXML(SpatialReference self, char const * dialect="") -> OGRErr""" return _osr.SpatialReference_ExportToXML(self, *args) def ExportToMICoordSys(self, *args): r"""ExportToMICoordSys(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_ExportToMICoordSys(self, *args) def ExportToCF1(self, options = {}): """ Export a CRS to netCDF CF-1 definitions. http://cfconventions.org/cf-conventions/cf-conventions.html#appendix-grid-mappings """ keyValues = _osr.SpatialReference_ExportToCF1(self, options) for key in keyValues: val = keyValues[key] try: val = float(val) keyValues[key] = val except: try: val = [float(x) for x in val.split(',')] keyValues[key] = val except: pass return keyValues def ExportToCF1Units(self, *args): r"""ExportToCF1Units(SpatialReference self, char ** options=None) -> retStringAndCPLFree *""" return _osr.SpatialReference_ExportToCF1Units(self, *args) def CloneGeogCS(self, *args): r"""CloneGeogCS(SpatialReference self) -> SpatialReference""" return _osr.SpatialReference_CloneGeogCS(self, *args) def Clone(self, *args): r"""Clone(SpatialReference self) -> SpatialReference""" return _osr.SpatialReference_Clone(self, *args) def StripVertical(self, *args): r"""StripVertical(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_StripVertical(self, *args) def Validate(self, *args): r"""Validate(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_Validate(self, *args) def MorphToESRI(self, *args): r"""MorphToESRI(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_MorphToESRI(self, *args) def MorphFromESRI(self, *args): r"""MorphFromESRI(SpatialReference self) -> OGRErr""" return _osr.SpatialReference_MorphFromESRI(self, *args) def ConvertToOtherProjection(self, *args): r"""ConvertToOtherProjection(SpatialReference self, char const * other_projection, char ** options=None) -> SpatialReference""" return _osr.SpatialReference_ConvertToOtherProjection(self, *args) def PromoteTo3D(self, *args): r"""PromoteTo3D(SpatialReference self, char const * name=None) -> OGRErr""" return _osr.SpatialReference_PromoteTo3D(self, *args) def DemoteTo2D(self, *args): r"""DemoteTo2D(SpatialReference self, char const * name=None) -> OGRErr""" return _osr.SpatialReference_DemoteTo2D(self, *args) def __init__(self, *args, **kwargs): """__init__(OSRSpatialReferenceShadow self, char const * wkt) -> SpatialReference""" _WarnIfUserHasNotSpecifiedIfUsingExceptions() try: with ExceptionMgr(useExceptions=True): this = _osr.new_SpatialReference(*args, **kwargs) finally: pass if hasattr(_osr, "SpatialReference_swiginit"): # SWIG 4 way _osr.SpatialReference_swiginit(self, this) else: # SWIG < 4 way try: self.this.append(this) except __builtin__.Exception: self.this = this # Register SpatialReference in _osr: _osr.SpatialReference_swigregister(SpatialReference) class CoordinateTransformationOptions(object): r"""Proxy of C++ OGRCoordinateTransformationOptions class.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, *args): r"""__init__(CoordinateTransformationOptions self) -> CoordinateTransformationOptions""" _osr.CoordinateTransformationOptions_swiginit(self, _osr.new_CoordinateTransformationOptions(*args)) __swig_destroy__ = _osr.delete_CoordinateTransformationOptions def SetAreaOfInterest(self, *args): r"""SetAreaOfInterest(CoordinateTransformationOptions self, double westLongitudeDeg, double southLatitudeDeg, double eastLongitudeDeg, double northLatitudeDeg) -> bool""" return _osr.CoordinateTransformationOptions_SetAreaOfInterest(self, *args) def SetOperation(self, *args): r"""SetOperation(CoordinateTransformationOptions self, char const * operation, bool inverseCT=False) -> bool""" return _osr.CoordinateTransformationOptions_SetOperation(self, *args) def SetDesiredAccuracy(self, *args): r"""SetDesiredAccuracy(CoordinateTransformationOptions self, double accuracy) -> bool""" return _osr.CoordinateTransformationOptions_SetDesiredAccuracy(self, *args) def SetBallparkAllowed(self, *args): r"""SetBallparkAllowed(CoordinateTransformationOptions self, bool allowBallpark) -> bool""" return _osr.CoordinateTransformationOptions_SetBallparkAllowed(self, *args) def SetOnlyBest(self, *args): r"""SetOnlyBest(CoordinateTransformationOptions self, bool onlyBest) -> bool""" return _osr.CoordinateTransformationOptions_SetOnlyBest(self, *args) # Register CoordinateTransformationOptions in _osr: _osr.CoordinateTransformationOptions_swigregister(CoordinateTransformationOptions) class CoordinateTransformation(object): r""" Python proxy of an :cpp:class:`OGRCoordinateTransformation`. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, *args): r""" __init__(CoordinateTransformation self, SpatialReference src, SpatialReference dst) -> CoordinateTransformation __init__(CoordinateTransformation self, SpatialReference src, SpatialReference dst, CoordinateTransformationOptions options) -> CoordinateTransformation Python proxy of an :cpp:class:`OGRCoordinateTransformation`. """ _osr.CoordinateTransformation_swiginit(self, _osr.new_CoordinateTransformation(*args)) __swig_destroy__ = _osr.delete_CoordinateTransformation def GetInverse(self, *args): r"""GetInverse(CoordinateTransformation self) -> CoordinateTransformation""" return _osr.CoordinateTransformation_GetInverse(self, *args) def _TransformPoint3Double(self, *args): r"""_TransformPoint3Double(CoordinateTransformation self, double [3] inout)""" return _osr.CoordinateTransformation__TransformPoint3Double(self, *args) def _TransformPoint4Double(self, *args): r"""_TransformPoint4Double(CoordinateTransformation self, double [4] inout)""" return _osr.CoordinateTransformation__TransformPoint4Double(self, *args) def TransformPoint(self, *args): """ TransformPoint(CoordinateTransformation self, double [3] inout) TransformPoint(CoordinateTransformation self, double [4] inout) TransformPoint(CoordinateTransformation self, double x, double y, double z=0.0) TransformPoint(CoordinateTransformation self, double x, double y, double z, double t) Transform a single point. See :cpp:func:`OCTTransform`. Returns ------- tuple A tuple of (x, y, z) or (x, y, z, t) values, depending on the input. Examples -------- >>> wgs84 = osr.SpatialReference() >>> wgs84.ImportFromEPSG(4326) 0 >>> vt_sp = osr.SpatialReference() >>> vt_sp.ImportFromEPSG(5646) 0 >>> ct = osr.CoordinateTransformation(wgs84, ps) >>> ct.TransformPoint(-72.58, 44.26) (7390620.052019633, -51202148.77747277, 0.0) >>> ct.TransformPoint(-72.58, 44.26, 103) (7390620.052019633, -51202148.77747277, 103.0) """ import collections.abc if len(args) == 1 and isinstance(args[0], collections.abc.Sequence): len_args = len(args[0]) if len_args == 3: return self._TransformPoint3Double(args[0]) elif len_args == 4: return self._TransformPoint4Double(args[0]) return _osr.CoordinateTransformation_TransformPoint(self, *args) def TransformPointWithErrorCode(self, *args): r""" TransformPointWithErrorCode(CoordinateTransformation self, double x, double y, double z, double t) Variant of :py:meth:`TransformPoint` that provides an error code. See :cpp:func:`OCTTransformEx`. Parameters ---------- x : float y : float z : float t : float Returns ------- tuple tuple of (x, y, z, t, error) values """ return _osr.CoordinateTransformation_TransformPointWithErrorCode(self, *args) def TransformPoints(self, *args): r""" TransformPoints(CoordinateTransformation self, int nCount) Transform multiple points. See :cpp:func:`OCTTransform`. Parameters ---------- arg A list of tuples, or a 2xN, 3xN, or 4xN numpy array Returns ------- list A list of tuples of (x, y, z) or (x, y, z, t) values, depending on the input. Examples -------- >>> ct.TransformPoints([(-72.58, 44.26), (-72.59, 44.26)]) [(7390620.052019633, -51202148.77747277, 0.0), (7387261.070131293, -51200373.68798984, 0.0)] >>> import numpy as np >>> ct.TransformPoints(np.array([[-72.58, 44.26], [-72.59, 44.26]])) [(7390620.052019633, -51202148.77747277, 0.0), (7387261.070131293, -51200373.68798984, 0.0)] """ return _osr.CoordinateTransformation_TransformPoints(self, *args) def TransformBounds(self, *args): r""" TransformBounds(CoordinateTransformation self, double minx, double miny, double maxx, double maxy, int densify_pts) Transform a boundary, densifying the edges to account for nonlinear transformations along these edges. See :cpp:func:`OCTTransformBounds`. Parameters ---------- minx : float Minimum bounding coordinate of the first axis in source CRS miny : float Minimum bounding coordinate of the second axis in source CRS maxx : float Maximum bounding coordinate of the first axis in source CRS maxy : float Maximum bounding coordinate of the second axis in source CRS densify_pts : int The number of points to use to densify the bounding polygon. Recommended to use 21. Returns ------- tuple Transformed values of xmin, ymin, xmax, ymax Examples -------- >>> ct.TransformBounds(-72.5, 44.2, -72.4, 44.3, 21) (7415356.140468472, -51238192.683464445, 7454323.154814391, -51210287.42581475) """ return _osr.CoordinateTransformation_TransformBounds(self, *args) # Register CoordinateTransformation in _osr: _osr.CoordinateTransformation_swigregister(CoordinateTransformation) def CreateCoordinateTransformation(*args): r""" CreateCoordinateTransformation(SpatialReference src, SpatialReference dst, CoordinateTransformationOptions options=None) -> CoordinateTransformation Create a :py:class:`CoordinateTransformation` using a set of :py:class:`CoordinateTransformationOptions`. See :cpp:func:`OCTNewCoordinateTransformationEx`. Parameters ---------- src : SpatialReference source spatial reference system dst : SpatialReference target spatial reference ystem options : CoordinateTransformationOptions Returns ------- CoordinateTransformation """ return _osr.CreateCoordinateTransformation(*args) OSR_CRS_TYPE_GEOGRAPHIC_2D = _osr.OSR_CRS_TYPE_GEOGRAPHIC_2D OSR_CRS_TYPE_GEOGRAPHIC_3D = _osr.OSR_CRS_TYPE_GEOGRAPHIC_3D OSR_CRS_TYPE_GEOCENTRIC = _osr.OSR_CRS_TYPE_GEOCENTRIC OSR_CRS_TYPE_PROJECTED = _osr.OSR_CRS_TYPE_PROJECTED OSR_CRS_TYPE_VERTICAL = _osr.OSR_CRS_TYPE_VERTICAL OSR_CRS_TYPE_COMPOUND = _osr.OSR_CRS_TYPE_COMPOUND OSR_CRS_TYPE_OTHER = _osr.OSR_CRS_TYPE_OTHER class CRSInfo(object): r"""Proxy of C++ OSRCRSInfo class.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr auth_name = property(_osr.CRSInfo_auth_name_get, doc=r"""auth_name : p.char""") code = property(_osr.CRSInfo_code_get, doc=r"""code : p.char""") name = property(_osr.CRSInfo_name_get, doc=r"""name : p.char""") type = property(_osr.CRSInfo_type_get, doc=r"""type : OSRCRSType""") deprecated = property(_osr.CRSInfo_deprecated_get, doc=r"""deprecated : bool""") bbox_valid = property(_osr.CRSInfo_bbox_valid_get, doc=r"""bbox_valid : bool""") west_lon_degree = property(_osr.CRSInfo_west_lon_degree_get, doc=r"""west_lon_degree : double""") south_lat_degree = property(_osr.CRSInfo_south_lat_degree_get, doc=r"""south_lat_degree : double""") east_lon_degree = property(_osr.CRSInfo_east_lon_degree_get, doc=r"""east_lon_degree : double""") north_lat_degree = property(_osr.CRSInfo_north_lat_degree_get, doc=r"""north_lat_degree : double""") area_name = property(_osr.CRSInfo_area_name_get, doc=r"""area_name : p.char""") projection_method = property(_osr.CRSInfo_projection_method_get, doc=r"""projection_method : p.char""") def __init__(self, *args): r"""__init__(CRSInfo self, char const * auth_name, char const * code, char const * name, OSRCRSType type, bool deprecated, bool bbox_valid, double west_lon_degree, double south_lat_degree, double east_lon_degree, double north_lat_degree, char const * area_name, char const * projection_method) -> CRSInfo""" _osr.CRSInfo_swiginit(self, _osr.new_CRSInfo(*args)) __swig_destroy__ = _osr.delete_CRSInfo # Register CRSInfo in _osr: _osr.CRSInfo_swigregister(CRSInfo) def OSRCRSInfo_auth_name_get(*args): r"""OSRCRSInfo_auth_name_get(CRSInfo crsInfo) -> char const *""" return _osr.OSRCRSInfo_auth_name_get(*args) def OSRCRSInfo_code_get(*args): r"""OSRCRSInfo_code_get(CRSInfo crsInfo) -> char const *""" return _osr.OSRCRSInfo_code_get(*args) def OSRCRSInfo_name_get(*args): r"""OSRCRSInfo_name_get(CRSInfo crsInfo) -> char const *""" return _osr.OSRCRSInfo_name_get(*args) def OSRCRSInfo_type_get(*args): r"""OSRCRSInfo_type_get(CRSInfo crsInfo) -> OSRCRSType""" return _osr.OSRCRSInfo_type_get(*args) def OSRCRSInfo_deprecated_get(*args): r"""OSRCRSInfo_deprecated_get(CRSInfo crsInfo) -> bool""" return _osr.OSRCRSInfo_deprecated_get(*args) def OSRCRSInfo_bbox_valid_get(*args): r"""OSRCRSInfo_bbox_valid_get(CRSInfo crsInfo) -> bool""" return _osr.OSRCRSInfo_bbox_valid_get(*args) def OSRCRSInfo_west_lon_degree_get(*args): r"""OSRCRSInfo_west_lon_degree_get(CRSInfo crsInfo) -> double""" return _osr.OSRCRSInfo_west_lon_degree_get(*args) def OSRCRSInfo_south_lat_degree_get(*args): r"""OSRCRSInfo_south_lat_degree_get(CRSInfo crsInfo) -> double""" return _osr.OSRCRSInfo_south_lat_degree_get(*args) def OSRCRSInfo_east_lon_degree_get(*args): r"""OSRCRSInfo_east_lon_degree_get(CRSInfo crsInfo) -> double""" return _osr.OSRCRSInfo_east_lon_degree_get(*args) def OSRCRSInfo_north_lat_degree_get(*args): r"""OSRCRSInfo_north_lat_degree_get(CRSInfo crsInfo) -> double""" return _osr.OSRCRSInfo_north_lat_degree_get(*args) def OSRCRSInfo_area_name_get(*args): r"""OSRCRSInfo_area_name_get(CRSInfo crsInfo) -> char const *""" return _osr.OSRCRSInfo_area_name_get(*args) def OSRCRSInfo_projection_method_get(*args): r"""OSRCRSInfo_projection_method_get(CRSInfo crsInfo) -> char const *""" return _osr.OSRCRSInfo_projection_method_get(*args) def GetCRSInfoListFromDatabase(*args): r"""GetCRSInfoListFromDatabase(char const * authName)""" return _osr.GetCRSInfoListFromDatabase(*args) def SetPROJSearchPath(*args): r"""SetPROJSearchPath(char const * utf8_path)""" return _osr.SetPROJSearchPath(*args) def SetPROJSearchPaths(*args): r"""SetPROJSearchPaths(char ** paths)""" return _osr.SetPROJSearchPaths(*args) def GetPROJSearchPaths(*args): r"""GetPROJSearchPaths() -> char **""" return _osr.GetPROJSearchPaths(*args) def GetPROJVersionMajor(*args): r"""GetPROJVersionMajor() -> int""" return _osr.GetPROJVersionMajor(*args) def GetPROJVersionMinor(*args): r"""GetPROJVersionMinor() -> int""" return _osr.GetPROJVersionMinor(*args) def GetPROJVersionMicro(*args): r"""GetPROJVersionMicro() -> int""" return _osr.GetPROJVersionMicro(*args) def GetPROJEnableNetwork(*args): r"""GetPROJEnableNetwork() -> bool""" return _osr.GetPROJEnableNetwork(*args) def SetPROJEnableNetwork(*args): r"""SetPROJEnableNetwork(bool enabled)""" return _osr.SetPROJEnableNetwork(*args) def SetPROJAuxDbPath(*args): r"""SetPROJAuxDbPath(char const * utf8_path)""" return _osr.SetPROJAuxDbPath(*args) def SetPROJAuxDbPaths(*args): r"""SetPROJAuxDbPaths(char ** paths)""" return _osr.SetPROJAuxDbPaths(*args) def GetPROJAuxDbPaths(*args): r"""GetPROJAuxDbPaths() -> char **""" return _osr.GetPROJAuxDbPaths(*args)