[gdal-dev] Translating ArcInfo binary grid to USGS .dem in C# via GDAL

supercooper supercooper at gmail.com
Fri May 13 13:13:32 EDT 2011


For transparency's sake, I posted this to gis.stackexchange
(http://gis.stackexchange.com/questions/9609/translating-grid-to-usgs-dem-in-c-via-gdal),
but haven't heard anything that really helps, so I thought this might be a
better place to seek help.

I am attempting to translate ArcInfo binary grids to USGS DEM format (.dem)
for input into VUE Infinite, a 3D visualization program. I am *very* new to
GDAL, and I have installed the GDAL .NET bindings thru a
(http://vbkto.dyndns.org/sdk/PackageList.aspx?file=release-1500-gdal-1-8-0-mapserver-5-6-6.zip)
build installer. I can get to GDAL in my C# solution I am working on.
However, it seems that I cannot create a USGS DEM:

Gdal.AllRegister();
GDAL.Dataset originalImage = Gdal.Open("C:\\65587895\\hdr.adf",
GDAL.Access.GA_ReadOnly);
Driver demDriver = Gdal.GetDriverByName("USGSDEM");

int x = originalImage.RasterXSize;
int y = originalImage.RasterYSize;
String[] opts = new String[] { "PRODUCT=DEFAULT,ZRESOLUTION=float" };

Dataset dsDem = demDriver.Create("C:\\Data\\65587895\\foo.dem", x, y, 1,
DataType.GDT_Int16, opts);

Gives the error:

System.ApplicationException: GDALDriver::Create() ... no create method
implemented for this format.

I thought the USGSDEM format was read/write...am I wrong on that? The
formats list (http://www.gdal.org/formats_list.html) says that creation of
USGSDEM is supported, but a run of demDriver.GetMetadata(null) to get the
metadata from the USGSDEM driver results in no return DCAP_CREATE=YES, only
DCAP_CREATECOPY=YES, which makes me cringe, thinking that indeed the
GDALDriver::Create() method is not implemented for the USGSDEM format.

I've also poked thought the source for the USGSDEM format, and don't see
anything in there pertaining to creating a dem (although I could easily miss
that, as I am by no means fluent in C++).

Any thoughts or experience with this? Any other thoughts on translating
ArcInfo binary grids (or anything for that matter) to DEMs?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Translating-ArcInfo-binary-grid-to-USGS-dem-in-C-via-GDAL-tp6360189p6360189.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list