I'm trying to use the Leaflet.VectorGrid API to load a GeoJSON in a leaflet map, but no matter what I try I keep getting this error:
Uncaught (in promise) TypeError: this._makeFeatureParts is not a function
at e.initialize (vectorgrid.js:1085)
at e (leaflet.js:5)
at e._createLayer (vectorgrid.js:1039)
at e.<anonymous> (vectorgrid.js:977)
at <anonymous>
It looks like the source of the error is this part of the JavaScript:
_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)
}
which is lines 1092-1096 of source script.
The GeoJSON I'm using is a bunch of points, and works with other Leaflet functions.
This is the relevant part of the script I'm using for the vector grid:
var vectorGrid = L.vectorGrid.slicer(myGeoJSON).addTo(map);
Any idea what I'm missing that's generating that error? I was hoping to just be able to add a simple layer to see how it worked, but now I can't get past the first step. I've tried different GeoJSONs and adding more to the command, but with no luck.
Edit: I was able to get a working solution by reading up on the info provided by the answer below. Here's what I did to get it to work..