Skip to content

Identify: support custom vocabularies for the media type attribute #12871

Description

@allyoucanmap

Description

The media display type introduced in #12786 reads the media type from another attribute (mediaTypeAttribute), but only recognises MIME strings (image/png, application/pdf) or the literal display type names (image, video, panorama, ...).

Datasets often use their own vocabulary for that column: IMG, VID, PAN, 360, or numeric codes. Those values are not recognised, so the attribute falls back to file extension detection. That is not enough, because a panorama is a .jpg and cannot be told apart from a plain image.

Proposal

Add an instance level alias configuration in localConfig.json:

{
  "featureInfoMediaTypeAliases": {
    "panorama": ["PAN", "PANO", "360"],
    "image": ["IMG", "FOTO"],
    "video": ["VID"]
  }
}

This new configuration will allow to have aliases to resolve correctly the media type in a project. These are the changes we will need to introduce:

  • One featureInfoMediaTypeAliases in localConfig.json global for the whole application.
  • Implementation and support needs to be introduced in the resolveAttributeDisplayType function (access the configuration with ConfigUtils.getConfigProp).
  • Value normalized with String(value).trim().toLowerCase() to support also numeric value.
  • Configuration keys must validated against DISPLAY_TYPES so a typo can't invent a renderer.
  • Documentation

What kind of improvement you want to add? (check one with "x", remove the others)

  • Minor changes to existing features

Other useful information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions