Skip to content

within expression returns inconsistent value when point is on the boundary #9411

@zmiao

Description

@zmiao

mapbox-gl-js version:
master
browser:
chrome

Steps to Trigger Behavior

Running following style, and zoom in or zoom out.

  "version": 8,
  "sources": {
    "points": {
      "type": "geojson",
      "data": {
        "type": "FeatureCollection",
        "features": [
          {
            "type": "Feature",
            "geometry": {
              "type": "Point",
              "coordinates": [ 5, 5]
            }
          }
        ]
      }
    },
    "polygon": {
      "type": "geojson",
      "data": {
        "type": "FeatureCollection",
        "features": [
          {
            "type": "Feature",
            "properties": {},
            "geometry": {
              "type": "Polygon",
              "coordinates": [
                [
                  [-5, -5],
                  [5, -5],
                  [5, 5],
                  [-5, 5],
                  [-5,-5]
                ]
              ]
            }
          }
        ]
      }
    }
  },
  "layers": [
    {
      "id": "border",
      "type": "fill",
      "source": "polygon",
      "paint": {
        "fill-color": "black",
        "fill-opacity": 0.5
      }
    },
    {
      "id": "points",
      "type": "circle",
      "source": "points",
      "paint": {
        "circle-color": [
          "case",
          [
            "within",
            {
              "type": "Polygon",
              "coordinates": [
                [
                  [-5, -5],
                  [5, -5],
                  [5, 5],
                  [-5, 5],
                  [-5,-5]
                ]
              ]
            }
          ],
          "red",
          "blue"
        ],
      }
    }
  ]
}

Link to Demonstration

Expected Behavior

The circle keeps blue color

Actual Behavior

The circle color is flickering when zooming in and zooming out.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions