Select to view content in your preferred language

Maps SDK for Qt paint bathymetric data with NaN values

207
2
a week ago
apalomer-iqua
New Contributor

I am evaluating the ArcGIS Maps SDK for Qt to see if it fits our needs. To test it, I have done a small project for a map and scene viewer.  In both viewers, I import a GeoTIF (data/bathymetry.tif) which is an elevation map of the seabed. This image contains negative values and the areas that are not covered, are set to NaN. My test code paints that image using a BlendRenderer and a ColorRamp:

 

 

 Esri::ArcGISRuntime::Raster *elevation_raster = new Esri::ArcGISRuntime::Raster(bathymetryPath(), parent);
  Esri::ArcGISRuntime::RasterLayer *raster_layer_color_ramp =
    new Esri::ArcGISRuntime::RasterLayer(elevation_raster, parent);
  QList<double> output_min_values;
  QList<double> output_max_values;
  QList<double> source_min_values{ -16 };
  QList<double> source_max_values{ 0 };
  QList<double> no_data_values;
  QList<double> gammas;
  double altitude = 50.;
  double azimuth = 15.;
  double z_factor = 1.;
  double pixel_size_factor = 1.;
  double pixel_size_power = 1.;
  int output_bit_depth = 8;
  Esri::ArcGISRuntime::ColorRamp *color_ramp =
  Esri::ArcGISRuntime::ColorRamp::create(Esri::ArcGISRuntime::PresetColorRampType::Elevation, 800, parent);
  Esri::ArcGISRuntime::BlendRenderer *renderer = new Esri::ArcGISRuntime::BlendRenderer(
    elevation_raster, output_min_values, output_max_values, source_min_values, source_max_values, no_data_values,
    gammas, color_ramp, altitude, azimuth, z_factor, Esri::ArcGISRuntime::SlopeType::Scaled, pixel_size_factor,
    pixel_size_power, output_bit_depth, parent);
  raster_layer_color_ramp->setRenderer(renderer);

 

 

The result is the following:

apalomeriqua_0-1740986137407.png 

Which is not displayed as I expect it because the non-covered area of the seabed is also painted. 

I have two questions: 

  1. How can I make the NaN values transparent?
  2. Is there any way to paint it with color scale such as the following one? Maybe also combine it with the shading effect of how it is now colored?

029-r-color-palettes-r-color-scales-1.png

0 Kudos
2 Replies
apalomer-iqua
New Contributor

I have tried without succes to use

QList<double> no_data_values{ std::nan("") };
0 Kudos
JamesBallard1
Esri Regular Contributor

Hi @apalomer-iqua.

I pulled down your test project and got it built locally. I was going to recommend using a raster mask function, but it looks like you beat me to it here: https://bitbucket.org/apalomeriqua/arcgis_test/src/24056f737a006278fa6ff7934d83e129bbd1b4ee/src/test...

Testing it out locally with version 200.6.0 does have the desired effect for me on macOS. It should be the same on Linux or other platforms as well.

Screenshot 2025-03-06 at 4.46.30 PM.png

Screenshot 2025-03-06 at 4.44.33 PM.png

And with the basemap present and all layers visible:

Screenshot 2025-03-06 at 4.50.04 PM.png

Is this what you were trying to achieve?

For the question about color scales, you would need to use Colormap and ColormapRenderer instead of the BlendRenderer.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-colormap.html

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-colormaprenderer.html 

0 Kudos