Use the fdo dll read the .htf file have two questions.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Use the fdo dll read the .htf file have two questions.

This post has NOT been accepted by the mailing list yet.
We are using the C# wrapper of FDO to load ADRG files. Here we have 2 questions when reading a .htf  file:
1. Use fdo 3.5 reading .htf(have three img file), only one img file is read,  the other two img files are not read.
Use Global mapper show:
(Use Global Mapper show)

Use fdo 3.5 dll show:
(Use fdo 3.5 dll show)

            fdoConnection = FeatureAccessManager.GetConnectionManager().CreateConnection(“OSGeo.Gdal.3.5”);
            fdoConnection.ConnectionString = “DefaultRasterFileLocation=D:\\ResolveProblem\\SanDiegoADRG\\TRANSH01.THF“;

          ConnectionState state = fdoConnection.Open();
             IDescribeSchema schemaCommand = null;
             schemaCommand = (IDescribeSchema)(fdoConnection.CreateCommand(CommandType.CommandType_DescribeSchema));      
                // It only have one item in the returned schemaCollection
                FeatureSchemaCollection schemaCollection = schemaCommand.Execute();
               string   featureSchemaName = schemaCollection[0].Name;              //"default"
               string   featureClassName = schemaCollection[0].Classes[0].Name;    //"default"

                PropertyDefinitionCollection properties = schemaCollection[featureSchemaName].Classes[featureClassName].Properties;
                foreach (PropertyDefinition property in properties)
                    if (property.PropertyType == PropertyType.PropertyType_RasterProperty)
                       string rasterColumnName = property.Name;   // "Raster"

            ISelect selectCmd = (ISelect)(fdoConnection.CreateCommand(CommandType.CommandType_Select));
            IFeatureReader reader = selectCmd.Execute();
            if (reader.ReadNext())
                IRaster raster = reader.GetRaster(rasterColumnName);
                byte[] bytes = raster.Bounds;
                double minX = double.MaxValue;
                double minY = double.MaxValue;
                double maxX = double.MinValue;
                double maxY = double.MinValue;
                for (int i = 0; i < 5; i++)
                    double tempX = BitConverter.ToDouble(bytes, 16 + i * 16);
                    double tempY = BitConverter.ToDouble(bytes, 16 + i * 16 + 8);
                    minX = Math.Min(tempX, minX);
                    minY = Math.Min(tempY, minY);
                    maxX = Math.Max(tempX, maxX);
                    maxY = Math.Max(tempY, maxY);
                boundings = new double[4] { minX, maxY, maxX, minY };
                imageWidth = raster.ImageXSize;
                imageHeight = raster.ImageYSize;

The boundings only includes the first img, doesn’t include the other two imgs.

2.  if use fdo 3.6 or 3.7, it return false in  the method of  "reader.ReadNext()" so we can't get any info from the file.