earthworks icon indicating copy to clipboard operation
earthworks copied to clipboard

Choose a specific type icon when there are multiple resource types

Open thatbudakguy opened this issue 5 months ago • 1 comments

Both of these items are rasters:

https://earthworks.stanford.edu/catalog/stanford-zh312vg7278 https://earthworks.stanford.edu/catalog/stanford-nz275ty2290

However, only zh312vg7278 displays "raster" as its type in the header icons area – nz275ty2290 shows "dataset". The more specific value ("raster") is preferable here.

I think this is because zh312vg7278 has only a single resource type ("Raster data") and nz275ty2290 has both "Raster data" and "Nautical charts". This confuses our logic that tries to pick an icon from the resource types, because there are two to choose from.

I think the right logic looks like this:

  1. If the record has a resource class of "Datasets" a. If the record has a resource type in the OGM community list vocabulary, use that resource type as the icon b. Otherwise, use "Datasets" as the icon
  2. Otherwise, use the default behavior of geoblacklight_icon

Keeping in mind that resource type is a controlled vocabulary with two separate valid lists of vocab – the LOC values, which are more applicable to maps and won't translate to an icon, and the OGM community values, which are more applicable to geospatial data (including rasters) and will usually map to a particular icon.

For nz275ty2290, "Raster data" comes from the OGM list, but "Nautical charts" comes from the LOC list.

In the (very unlikely and maybe impossible?) event that there are two or more values in resource type from the OGM list, I think it's perfectly acceptable to just pick one, regardless of order.

thatbudakguy avatar Sep 11 '24 17:09 thatbudakguy