Daniel G
Daniel G

Reputation: 31

Leaflet - weird looking map with circle shapes

I was using an outdated veriosn of leaflet 1.0.0. Updated to the newest version 1.6.0 and I'm observing odd behaviour at different zoom levels.

Illustration of this behaviour

The larger the zoom, the more precise the diameters are.

I'am using L.Circle with constant radius and equals 0.14

Tried scaling everything and switching between canvas and svg rendering engine.

Upvotes: 2

Views: 228

Answers (2)

Daniel G
Daniel G

Reputation: 31

I've just figured out a workaround to this problem in leaflet-src.js:

changed:

 _round: function () {
    this.x = Math.round(this.x);
    this.y = Math.round(this.y);
    return this;
 },

to just:

_round: function () {
    return this;
},

it works for me.

Upvotes: 1

Falke Design
Falke Design

Reputation: 11338

In your fiddle you are useing a old version of leaflet:

http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js should be: https://unpkg.com/[email protected]/dist/leaflet.js

http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css should be: https://unpkg.com/[email protected]/dist/leaflet.css

After I updated leaflet, the circles showing correct

Upvotes: 1

Related Questions