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

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

Closed

Description

@zmiao

When feature is on the polygon boundary, within returns inconsistent value, which will cause flickering styling for the feature.

Reproducable with style:

{
  "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"
        ],
      }
    }
  ]
}

Activity

  1. self-assigned this
    on Mar 11, 2020
  2. 1ec5 commented on Mar 12, 2020

    @1ec5
    Contributor

    mapbox/mapbox-gl-js#9411 tracks the same issue on the GL JS side.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions