Select to view content in your preferred language

How do I query a voxel layer data value from give a coordinate?

185
2
3 weeks ago
YetaoYang
Emerging Contributor

I have a voxel layer (from netCDF file) in local scene. I want to query the data value of  the voxel layer by a give coordinate (x,y,z). I check the arcgis pro SDK and found that I access the voxellayer and voxelvome and the statistics of the data value such as maxvalue and minvalue:

//Get the first voxel layer in the TOC
 voxelLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<VoxelLayer>().FirstOrDefault();
 if (voxelLayer == null)
    return;
 QueuedTask.Run(() => {
    //access the volume
    var volume = voxelLayer.SelectedVariableProfile;
    var vol_size = volume.GetVolumeSize(); //(double X, double Y, double Z)
    //TODO - use the dimensions
    //vol_size.X, vol_size.Y, vol_size.Z
    ...
and also can get the statistics of the data value by:
/var voxelLayer = ... ;
 //Must be on the QueuedTask.Run()

 //get the selected variable profile
 var variable = voxelLayer.SelectedVariableProfile;
 //Must be continuous to have a stretch renderer
 if (variable.DataType != VoxelVariableDataType.Continuous)
   return;

 var renderer = variable.Renderer as CIMVoxelStretchRenderer;

 var color_min = renderer.ColorRangeMin;
 var color_max = renderer.ColorRangeMax;

 //increase color range by 10% of the current difference
 var dif = (color_max - color_min) * 0.05;
 color_min -= dif;
 color_max += dif;

 //make sure we our color range does not exceed the current 
 //renderer data range
 if (color_min < variable.GetVariableStatistics().MinimumValue)
    color_min = variable.GetVariableStatistics().MinimumValue;
 if (color_max > variable.GetVariableStatistics().MaximumValue)
    color_max = variable.GetVariableStatistics().MaximumValue;




  

 but I can not find a way to get the exact data value for a given coordinats (x,y,z)?

Anybody can kind help me?

Thanks!

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

From my opinion you need to make raster layer from NetCDF file using geoprocessing, then read value from raster layer.

0 Kudos
YetaoYang
Emerging Contributor

Thank you!  But this way will be slow for large voxel data for conversing the data type. I think reading the raw netCDF file by a cdf library in C# maybe faster

0 Kudos