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

Tile rendering shows lines / grid on map #6

Open
colbyfayock opened this issue May 17, 2021 · 0 comments
Open

Tile rendering shows lines / grid on map #6

colbyfayock opened this issue May 17, 2021 · 0 comments

Comments

@colbyfayock
Copy link

colbyfayock commented May 17, 2021

After the first render, when moving the map around, it shows a grid of lines

Screen Shot on 2021-05-17 at 07:52:55

I'm on Mac 11.3.1 Chrome Version 90.0.4430.212

I solved this in the past with the following snippet:

import L from 'leaflet';

(function () {
  if (typeof window === 'undefined') return;
  if (!L || !L.GridLayer || !L.GridLayer.prototype) return;

  var originalInitTile = L.GridLayer.prototype._initTile;

  L.GridLayer.include({
    _initTile: function (tile) {
      originalInitTile.call(this, tile);

      var tileSize = this.getTileSize();

      tile.style.width = tileSize.x + 1 + 'px';
      tile.style.height = tileSize.y + 1 + 'px';
    }
  });
})();

Source: https://github.com/Element84/fogg/blob/master/src/plugins/leaflet-tilelayer-subpixel-fix.js
Original: Leaflet/Leaflet#3575 (comment)

Alternatively you could set the background to a really dark color (like simply black) or the gray from the tiles and it makes it a lot less noticeable 🤷

image

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

No branches or pull requests

2 participants