Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Android] Expression interpolation with -0.1 and 0 as steps is not working #15532

Closed
kristfal opened this issue Aug 31, 2019 · 5 comments · Fixed by #15557
Closed

[Android] Expression interpolation with -0.1 and 0 as steps is not working #15532

kristfal opened this issue Aug 31, 2019 · 5 comments · Fixed by #15557
Labels
Android Mapbox Maps SDK for Android

Comments

@kristfal
Copy link

kristfal commented Aug 31, 2019

This is an upstream ticket for https://github.com/react-native-mapbox-gl/maps/issues/349

Steps to reproduce

  1. Define the following expression:
fillColor: [
      'interpolate',
      ['linear'],
      ['get', 'drval1'],
      -0.1,
      'red',
      0,
      'blue',
    ],
  },
  1. This will default to a black fillColor and log:
Mbgl    : {mapboxglexample}[JNI]: Error setting property: fill-color [5]: Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.

A few working variations are: [0, 'red', 0.1, 'blue'], [-0.1, 'red', 0.1, 'blue'].

Additional non-working variations: [-0.2, 'red', -0.1, 'blue'], [-0.9, 'red', -0.1, 'blue']

Expected behavior

The expression is valid for iOS and Web, and should be valid for Android as well.

Actual behavior

The expression is not valid for Android.

Configuration

Mapbox SDK versions: 8.2.1

@tobrun tobrun added Android Mapbox Maps SDK for Android needs reproduction and removed needs reproduction labels Sep 2, 2019
@tobrun
Copy link
Member

tobrun commented Sep 2, 2019

@kristfal Thank you for reaching out and providing a reproducible test. I was able to reproduce and attached a debugger to the expression validation:

image

You can see that we are handling both the -0.1 and 0 are treated as 0.

@tobrun
Copy link
Member

tobrun commented Sep 2, 2019

Quickly verified what we pass over to the c++ from java and that is looking as expected:

image

@tobrun
Copy link
Member

tobrun commented Sep 3, 2019

I went one step further down the chain, verified the values in our conversion system for value in android_conversion.hpp. Those seem to check out as well, except that we are inputting a float and converting it to a double:

Screenshot from 2019-09-03 15-08-50

Screenshot from 2019-09-03 15-09-51

@tobrun
Copy link
Member

tobrun commented Sep 3, 2019

🤦‍♂️, thanks @LukasPaczos for pointing out the long conversion issue. This should be the rootcause and removing fixes the issue.

@Bradeskojest
Copy link

A question. I have similar problems with zoom(), when "step" is only reacting to integer values, and not doubles or fractional zoom levels.

For example, this is only reacting to zoom steps at Integer values, even if ZOOM constant is 8.5:

  iconAllowOverlap(
                    step(zoom(), literal(false), stop(OVERLAP_ZOOM, true))
                ),

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants