Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value map for integer source attribute values not saved and interpreted correctly #279

Open
leendertvanwolfswinkel opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@leendertvanwolfswinkel
Copy link
Collaborator

Test data

topdesk 2410 0159.zip

Problem description

The configuration JSON in the test data contains this entry for friction_value:

    "friction_value": {
      "method": "source_attribute",
      "source_attribute": "SOORTMATER",
      "value_map": {
        "0": 0.02,
        "1": 0.011,
        "3": 0.02,
        "10": 0.02,
        "11": 0.011,
        "13": 0.011,
        "17": 0.02,
        "20": 0.011,
        "21": 0.011,
        "22": 0.02,
        "28": 0.011,
        "30": 0.02,
        "31": 0.02
      },
      "default_value": 0.02
    },

Note that the values are double-quoted. This is not something the user did, this happens when you save the configuration as a template JSON.

When you import weirs using this configuration, the source attribute values are written as target attribute values, instead of being mapped according to the value map.

The current workaround that the user came up with is to load the template, remove all the double quotes from the value map, and run the import. That workaround works, but is obv. not the desirable way to go.

How to reproduce

  • Add stuw_servicedesk.gpkg to the project
  • Load a schematisation
  • Open the Import weirs dialog
  • Choose "stuw_servicedesk" as source layer
  • Load template "import weirs V&V.json"
  • Import the weirs
  • The friction values that are written to new, imported weirs are

Suggested solution

Take the source attribute data type into account when interpreting the values in the value map? Or convert the source attribute value to string before looking it up in the value map?

@leendertvanwolfswinkel leendertvanwolfswinkel added the bug Something isn't working label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants