Skip to content

Missing type parameter in classification measurement payload for GdalMetaDataList #1054

Closed
@0xmycf

Description

@0xmycf

Hello,
I am currently implementing the ui (geoengine-ui) to change the measurement in the loading info.
I have noticed that, if I change the measurement to classification, the server responds with a malformed json response on a new page load.

This happens only for the classification measurement, not for continuous or unitless measurements.
In detail, the type parameter in the measurement object is missing, causing an exception when the frontend tries to figure out which type the measurement belongs to.

Steps to reproduce:

  • check out https://github.com/0xmycf/geoengine-ui/tree/measurement_editing
  • navigate to NDVI as GdalMetaDataList
  • change the measurement to some classification such as 1 foo 2 bar
  • click Apply
  • reload the NDVI as GdalMetaDataList
  • an error in the console should pop up ERROR Error: No variant of Measurement exists with 'type=undefined'

This is the json payload that is being send and received from the server: gist.github. (As you can see no type tag in the receiving payload for the classification measurement)

I've investigated a bit in the backend code and and printed the meta data objects right after/before they got send / received:

GdalMetaDataList(GdalMetaDataList { result_descriptor: RasterResultDescriptor { data_type: U8, spatial_reference: SpatialReference(SpatialReference { authority: Epsg, code: 4326 }), time: None, bbox: None, resolution: None, bands: RasterBandDescriptors([RasterBandDescriptor { name: "ndvi", 

measurement: 
  Classification(ClassificationMeasurement { measurement: "classification", classes: {0: "bar", 1: "foo"} }) }]) },

 params: [GdalLoadingInfoTemporalSlice { time: TimeInterval [1388534400000, 1391212800000), params: Some(GdalDatasetParameters { file_path: "test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2014-01-01.TIFF", rasterband_channel: 1, geo_transform: GdalDatasetGeoTransform { origin_coordinate: Coordinate2D { x: -180.0, y: 90.0 }, x_pixel_size: 0.1, y_pixel_size: -0.1 }, width: 3600, height: 1800, file_not_found_handling: NoData, no_data_value: Some(0.0), properties_mapping: Some([]), gdal_open_options: Some([]), gdal_config_options: Some([]), allow_alphaband_as_mask: false, retry: None }), cache_ttl: CacheTtlSeconds(0) }, GdalLoadingInfoTemporalSlice { time: TimeInterval [1391212800000, 1393632000000), params: Some(GdalDatasetParameters { file_path: "test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2014-02-01.TIFF", rasterband_channel: 1, geo_transform: GdalDatasetGeoTransform { origin_coordinate: Coordinate2D { x: -180.0, y: 90.0 }, x_pixel_size: 0.1, y_pixel_size: -0.1 }, width: 3600, height: 1800, file_not_found_handling: NoData, no_data_value: Some(0.0), properties_mapping: Some([]), gdal_open_options: Some([]), gdal_config_options: Some([]), allow_alphaband_as_mask: false, retry: None }), cache_ttl: CacheTtlSeconds(0) }] })

This is the meta_data obj right before we save it in the handler on the backend:

GdalMetaDataList(GdalMetaDataList { type: GdalMetaDataListTypeTag, result_descriptor: RasterResultDescriptor { data_type: U8, spatial_reference: SpatialReference(SpatialReference { authority: Epsg, code: 4326 }), time: None, bbox: None, resolution: None, bands: RasterBandDescriptors([RasterBandDescriptor { name: "ndvi", 

measurement: 
  Classification(ClassificationMeasurement { type: ClassificationMeasurementTypeTag, measurement: "classification", classes: {2: "bar", 1: "foo"} }) }]) },

 params: [GdalLoadingInfoTemporalSlice { time: TimeInterval [1388534400000, 1391212800000), params: Some(GdalDatasetParameters { file_path: "test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2014-01-01.TIFF", rasterband_channel: 1, geo_transform: GdalDatasetGeoTransform { origin_coordinate: Coordinate2D { x: -180.0, y: 90.0 }, x_pixel_size: 0.1, y_pixel_size: -0.1 }, width: 3600, height: 1800, file_not_found_handling: NoData, no_data_value: Some(0.0), properties_mapping: Some([]), gdal_open_options: Some([]), gdal_config_options: Some([]), allow_alphaband_as_mask: false }), cache_ttl: CacheTtlSeconds(0) }, GdalLoadingInfoTemporalSlice { time: TimeInterval [1391212800000, 1393632000000), params: Some(GdalDatasetParameters { file_path: "test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2014-02-01.TIFF", rasterband_channel: 1, geo_transform: GdalDatasetGeoTransform { origin_coordinate: Coordinate2D { x: -180.0, y: 90.0 }, x_pixel_size: 0.1, y_pixel_size: -0.1 }, width: 3600, height: 1800, file_not_found_handling: NoData, no_data_value: Some(0.0), properties_mapping: Some([]), gdal_open_options: Some([]), gdal_config_options: Some([]), allow_alphaband_as_mask: false }), cache_ttl: CacheTtlSeconds(0) }] })

I am currently implementing the last bit of the same functionality for OgrSources and could look into this in more detail after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions