parameters: (srs_like: AnySRS,
              axis_order: Optional[OAMS_AXIS_ORDER] = None)
return_statement: return srs
docstring: returns an SRS object from epsg, pj_string or DataSet or SRS object
  
      gis_order and axis_order are mutually exclusive
      if gis_order is not None then axis_order is set according to gis_order
      if axis_order == None -> set axis order to default_axis_order iff the input is not an osr.SpatialReference reference,
      otherwise set requested axis_order
docstring_summary: returns an SRS object from epsg, pj_string or DataSet or SRS object
docstring_tokens: returns an SRS object from epsg pj_string or DataSet or SRS object
function: def get_srs(srs_like: AnySRS,
              axis_order: Optional[OAMS_AXIS_ORDER] = None) -> osr.SpatialReference:
      """
      returns an SRS object from epsg, pj_string or DataSet or SRS object
  
      gis_order and axis_order are mutually exclusive
      if gis_order is not None then axis_order is set according to gis_order
      if axis_order == None -> set axis order to default_axis_order iff the input is not an osr.SpatialReference reference,
      otherwise set requested axis_order
      """
      if isinstance(srs_like, osr.SpatialReference):
          srs = srs_like
      elif isinstance(srs_like, gdal.Dataset):
          srs = osr.SpatialReference()
          srs.ImportFromWkt(srs_like.GetProjection())
      elif isinstance(srs_like, int):
          srs = osr.SpatialReference()
          if srs.ImportFromEPSG(srs_like) != ogr.OGRERR_NONE:
              raise Exception(f'ogr error when parsing srs from epsg:{srs_like}')
      elif isinstance(srs_like, str):
          srs = osr.SpatialReference()
          if srs.SetFromUserInput(srs_like) != ogr.OGRERR_NONE:  # accept PROJ string, WKT, PROJJSON, etc.
              raise Exception(f'ogr error when parsing srs from user input: {srs_like}')
      else:
          raise Exception(f'Unknown SRS: {srs_like}')
  
      if axis_order is None and srs != srs_like:
          axis_order = _default_axis_order
      if axis_order is not None and int(osgeo.__version__[0]) >= 3:
          # GDAL 3 changes axis order: https://github.com/OSGeo/gdal/issues/1546
          if not isinstance(axis_order, OAMS_AXIS_ORDER):
              raise Exception(f'Unexpected axis_order: {axis_order}')
          srs_axis_order = srs.GetAxisMappingStrategy()
          if axis_order != srs_axis_order:
              if srs == srs_like:
                  # we don't want to change the input srs, thus create a copy
                  srs = srs.Clone()
              srs.SetAxisMappingStrategy(axis_order)
      return srs
function_tokens: def get_srs ( srs_like : AnySRS , axis_order : Optional [ OAMS_AXIS_ORDER ] = None ) -> osr . SpatialReference : if isinstance ( srs_like , osr . SpatialReference ) : srs = srs_like elif isinstance ( srs_like , gdal . Dataset ) : srs = osr . SpatialReference ( ) srs . ImportFromWkt ( srs_like . GetProjection ( ) ) elif isinstance ( srs_like , int ) : srs = osr . SpatialReference ( ) if srs . ImportFromEPSG ( srs_like ) != ogr . OGRERR_NONE : raise Exception ( f'ogr error when parsing srs from epsg:{srs_like}' ) elif isinstance ( srs_like , str ) : srs = osr . SpatialReference ( ) if srs . SetFromUserInput ( srs_like ) != ogr . OGRERR_NONE : # accept PROJ string, WKT, PROJJSON, etc. raise Exception ( f'ogr error when parsing srs from user input: {srs_like}' ) else : raise Exception ( f'Unknown SRS: {srs_like}' ) if axis_order is None and srs != srs_like : axis_order = _default_axis_order if axis_order is not None and int ( osgeo . __version__ [ 0 ] ) >= 3 : # GDAL 3 changes axis order: https://github.com/OSGeo/gdal/issues/1546 if not isinstance ( axis_order , OAMS_AXIS_ORDER ) : raise Exception ( f'Unexpected axis_order: {axis_order}' ) srs_axis_order = srs . GetAxisMappingStrategy ( ) if axis_order != srs_axis_order : if srs == srs_like : # we don't want to change the input srs, thus create a copy srs = srs . Clone ( ) srs . SetAxisMappingStrategy ( axis_order ) return srs