mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

[API Design] getters and setters for minZoom/maxZoom behave inconsistently

Open florianPOLARSTEPS opened this issue 3 years ago • 1 comments

Environment

  • Android OS version: Any
  • Devices affected: Any
  • Maps SDK Version: 10.8.1

Observed behavior and steps to reproduce

Given in my style I have any layer with no min/ max zoom properties set, like the following:

{
      "id" : "vector_land",
      "type" : "background",
      "layout" : {},
      "paint" : {...},
      "metadata" : {
        "mapbox:featureComponent" : "land-and-water",
        "mapbox:group" : "Land, water, & sky, land"
      }
    }

By accessing the zoom properties via layer.minZoom or layer.maxZoom the values returned are Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY.

The corresponding API to set the zoom properties though throws an exception when setting those values

val minZoomFromStyle = layer.minZoom
layer.minZoom(minZoomFromStyle)
// throws java.lang.IllegalArgumentException: Incorrect property value for minzoom: Value can not be Double.NaN, Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY

The documentation for minZoom and maxZoom is also outdated Screenshot 2022-10-18 at 10 17 52

Expected behavior

A well designed API or a changelog that contains breaking changes and accompanying documentation.

florianPOLARSTEPS avatar Oct 18 '22 08:10 florianPOLARSTEPS