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

[Bug] Artifact polygons when rendering GeoJsonLayer with transparency #8107

Open
1 of 7 tasks
eemilhaa opened this issue Sep 12, 2023 · 4 comments
Open
1 of 7 tasks
Labels

Comments

@eemilhaa
Copy link

Description

When rendering a GeoJsonLayer with transparency, artifact polygons show up:

image

3D panning affects the artifacts:

image

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

The geojson should render normally. Here is the exact same data on geojson.io:

image

I've also tested the same data on maplibre, where the artifacts are not present either.

Steps to Reproduce

I've made a repository for a minimal reproduction. It is identical to the deckgl polygon geojson example, with changes to only include one layer, and to include the data needed to reproduce.

The code (app.jsx):

import React from 'react';
import {createRoot} from 'react-dom/client';
import {Map} from 'react-map-gl';
import maplibregl from 'maplibre-gl';
import DeckGL from '@deck.gl/react';
import {GeoJsonLayer, PolygonLayer} from '@deck.gl/layers';

// Source data GeoJSON
const DATA = './data.geojson'

const INITIAL_VIEW_STATE = {
  longitude: 24.88,
  latitude: 60.25,
  zoom: 10,
  pitch: 0,
  bearing: 0
};

const MAP_STYLE = 'https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json';

export default function App({data = DATA, mapStyle = MAP_STYLE}) {
  const layers = [
    new GeoJsonLayer({
      id: 'geojson',
      data,
      opacity: 0.25,
      filled: true,
      getFillColor: f => [200, 0, 0],
    })
  ];

  return (
    <DeckGL
      layers={layers}
      initialViewState={INITIAL_VIEW_STATE}
      controller={true}
    >
      <Map reuseMaps mapLib={maplibregl} mapStyle={mapStyle} preventStyleDiffing={true} />
    </DeckGL>
  );
}

export function renderToDOM(container) {
  createRoot(container).render(<App />);
}

Environment

  • Framework version: [email protected]
  • Browser: Firefox 117.0, Chromium 116.0.5845.140
  • OS: Arch linux / Fedora linux 38

Logs

The console shows no errors.

@eemilhaa eemilhaa added the bug label Sep 12, 2023
@felixpalmer
Copy link
Collaborator

Could you try and isolate which polygon in your GeoJSON is causing the issue? I.e. the polygon which isn't visible in other renderers: https://github.com/eemilhaa/geojsonlayer-bug/blob/main/data.geojson

@eemilhaa
Copy link
Author

I managed to reproduce with just the outermost multipolygon. I updated the data accordingly.

image

@Pessimistress
Copy link
Collaborator

Thank you for sharing the data. I submitted a bug report for earcut: mapbox/earcut#162

@eemilhaa
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants