Hello
I am using GdalRasterLayer layer in order to load a .nsf file.
.nsf file can contain multiple images inside of it.
When I open an .nsf file that contains several image into a GdalRasterLayer I can only see 1 image
How can I get all the images?
The same question is also relevant for a .tif format that contains several images.
Thank you
Multiple image file
Hi Miri,
Thanks for your post!
Currently, we don’t support .nsf format data. I tried to search on the nsf file, but didn’t get any specification on it. I suspect if you means the .NITF file? gdal.org/frmt_nitf.html
Could you provide us further information and any sample/codes if you have?
Thanks,
Troy
Hello
.nsf file stands for NSIF format which is NATO specification for Stang4545, as explained here
nato.int/structur/ac/224/standard/4545/NSIF_Approved_SDEs.htm
NITF is the DoD specification.
To may understanding NSIF and NITF are quite equivalent.
So answering your question , yes I need to know how to extract multiple "pages"/"images" that are saves in a single NITF file
currently I am loading the NITF file to GdalRasterLayer like so, but i am able to see only one image (although there are several images in the file):
public static bool AddRasterLayers(string fileName, WpfMap map,out RasterLayer layer)
{
try
{
string layerName = new FileInfo(fileName).Name;
string extentionName = Path.GetExtension(fileName).ToUpperInvariant();
RasterLayer rasterLayer = null;
string key = KeyGen.NewStringKey();
switch (extentionName.ToLower())
{
case ".nsf":
case ".ntf":
rasterLayer = new GdalRasterLayer(fileName);
break;
case ".sid":
rasterLayer = new MrSidRasterLayer(fileName);
break;
case ".ecw":
rasterLayer = new EcwRasterLayer(fileName);
break;
case ".jp2":
rasterLayer = new Jpeg2000RasterLayer(fileName);
break;
case ".bmp":
case ".jpg":
case ".jpeg":
case ".gif":
case ".png":
rasterLayer = new GdiPlusRasterLayer(fileName);
break;
default:
break;
}
if (rasterLayer != null && ValidateRasterLayer(rasterLayer))
{
rasterLayer.Name = key;
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Name = key;
layerOverlay.TileType = TileType.SingleTile;
layerOverlay.Layers.Add(key, rasterLayer);
map.Overlays.Add(key, layerOverlay);
map.Refresh((map.Overlays[key]));
layer = rasterLayer;
return true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
}
layer = null;
return false;
}
private static bool ValidateRasterLayer(RasterLayer rasterLayer)
{
bool isValidate = true;
try
{
rasterLayer.Open();
}
catch (Exception ex)
{
isValidate = false;
}
finally
{
if (rasterLayer.IsOpen)
{
rasterLayer.Close();
}
}
return isValidate;
}
Hi Miri,
Thanks, I see now.
Would you mind to set the FeatureClassName and FeatureSchemaName properties to have a try? I looked into the codes and looks we does take the first FeatureClass and FeatureSchema if no featureclass and schema name are specified. Another thing is currently, we don’t provide an API to get all available featureCLasses and Schema names.
If the issue still exists, would you mind to send us your data?
Thanks,
Troy
Thank you for your help
Can you please explain what is the meaning of each parameter (there is no documentation in your code)
FeatureClassName
FeatureSchemaName
Does FeatureClassName represents the concrete file name ?
I saw that GdalRasterLayer also expose the following functions
LoadLayer(stream)
LoadLayer(uri)
what is there purpose, can they help me to perform the required task?
thank you in advance
Hi Miri,
We don’t have the similar documentation on FeatureClassName and Schema Name, as this is a common concept among Gis, especially in GisDatabase like Postgre, ArcSde etc… Here is a link about feature class wiki.gis.com/wiki/index.php/Feature_class
Actually, I think we can understand the Schema like a database name and the Feature class is more like a table name.
I checked your another thread and download the data, I found it looks have only one Schema named “default” and the schema’s feature class only has one feature class named “default”. So, I suspect if the file has only one image in the NITF file.
As for the LoadLayer(stream) and LoadLayer(Url), both of them are used to initialize the layer instance with difference ways and it’s inherit from base layer. In your case, I think you can skip it.
Thanks,
Troy