Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
601 stars 194 forks source link

vectorGrid.Slicer Throwing error with Point only geoJson #220

Closed DigDigDig closed 4 years ago

DigDigDig commented 4 years ago

I'm receiving an error when trying to load geoJson layers containing point only data.

Loading a local file with:

var layer = L.vectorGrid.slicer(boulderPicks, {
    vectorTileLayerStyles: {
        sliced: {
            radius: 1
        }
    }
}).addTo(map);

results in the following console message:

TypeError: right-hand side of 'in' should be an object, got number

The offending line of leaflet.vectorgrid begins at 1013

_makeFeatureParts: function (t, e) {
  var r = t.geometry[0][0];
  'x' in r && (this._point = L.point(r.x * e, r.y * e), this._empty = L.Util.falseFn)
},

I thought the geoJson I was using may be the problem so I tested the same code with other geojson files but had the same error logged. The other tests that I ran came in cleanly as L.geoJson.

DigDigDig commented 4 years ago

Looks like this is fixed in 1.3.0