My goal is to check that a shapefile and raster have the same projection and datum using EPSG number.
One can easily extract EPSG number from a shapefile by the following:
ds=ogr.Open(r'....satates48.shp') utm_sr=ds.GetSpatialReference() utm_sr.GetAttrValue('AUTHORITY',1)
This works great but how does one do the same for a raster file, you cannot, to my knowledge get a spatial reference of a raster.
One can get projection, or projecitonref (I am not sure if there is any difference), but you cannot do more, like:
This does not work. Perhaps there is an alternative way to do this?