read/save projection?
MatthieuStigler opened this issue · 6 comments
Hi Richard
Thanks a lot for this utility, awesome!!! I was wondering what happens with the projection of the raster? Is this kept as the original in the gdb? I am unfamiliar with the gdb as well as gtiff format, but was wondering whether it would be possible that ArcRasterRescue returns the info on the projection in the gtiff?
Thanks!!
@MatthieuStigler: I'm glad you've found this useful. It's on my TODO list to get this merged into GDAL, but I've been a bit slow about it. Do you have an example GDB (or several) that you could send me with projections attached? If so, I can probably figure out how to get those out for you.
@r-barnes thanks for your answer! Well the problem is that precisely I have a file whose projection I don't know, and as I don't have ArcGIS, don't know how to access it, or whether it is there or not... The files are the gSSURGO soil database, here is the smallest one: https://nrcs.app.box.com/v/soils/file/157052826669
Not sure whether it contains the projection, it ios said to be Alberas Equal Area with NAD83, but there are still many corresponding to that one...
Thanks!
@MatthieuStigler: I'm a wee bit swamped just now, so can we try a different solution first?
GDAL has a GDB driver, it just doesn't work with raster data (ESRI's primarily responsible for that). Is it possible for you to see if GDAL can get the projection of the dataset you mention?
From the command-line
gdalinfo mydata.gdb
should do it.
Good idea! So unfortunately, on my machine I don't seem to be able to open it, getting:
gdalinfo gSSURGO_MH.gdb
ERROR 4: `gSSURGO_MH.gdb' not recognized as a supported file format.
But using ogrinfo instead (seems to be part of gdal?), I obtain the projection (see below). I was not able to find the arguments to obtain the projection only. The problem is that -ro and -so
require an indication of the field/layer. So I used code below, but there's certainly something shorter/more elegant!
ogrinfo -ro -so gSSURGO_MH.gdb/ SAPOLYGON
PROJCS["Western_Pacific_Albers_Equal_Area_Conic",
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_84",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Albers_Conic_Equal_Area"],
PARAMETER["False_Easting",0.0],
PARAMETER["False_Northing",0.0],
PARAMETER["longitude_of_center",152.5],
PARAMETER["Standard_Parallel_1",8.0],
PARAMETER["Standard_Parallel_2",12.0],
PARAMETER["latitude_of_center",10.0],
UNIT["Meter",1.0]]
Thanks!!
GDAL started (I think) as a raster library and OGR was built out letter to handle vector datatypes. There's an on-going effort to unify them more, but it is at the bottom of everyone's priority list.
The code block you show is, indeed, all projection information. Never underestimate how complicated projections really are! Upcoming standards will define time components for projections, as it turns out that continental drift is fast enough that it's beginning to mess things up. (See this article about Australia, for instance.)
The text you've found is called "WKT". There may be conversion utilities from this to proj4 strings or standard EPSG codes (like this).
Can I mark this as closed?
Thanks a lot for the detailed answer. Yes, I understand fully reporting the projection is a very low priority! So it makes sense to mark this as closed!