glenrobertson / leaflet-tilelayer-geojson

Leaflet TileLayer for GeoJSON tiles
Other
250 stars 79 forks source link

TypeError: this._adjustTilePoint is not a function #49

Open gmarshall56 opened 3 years ago

gmarshall56 commented 3 years ago

In a React functional component, my code: ` var style = { "clickable": true, "color": "#00D", "fillColor": "#00D", "weight": 1.0, "opacity": 0.3, "fillOpacity": 0.2 }; var hoverStyle = { "fillOpacity": 0.5 };

    const geojsonURL = 'https://dla-maps-storage.s3.amazonaws.com/geoJSONFiles/testFAA.json';
    const geojsonTileLayer = new L.TileLayer.GeoJSON(geojsonURL, {
            clipTiles: true,
            unique: function (feature) {
                return feature.id;
            }
        }, {
            style: style,
            onEachFeature: function (feature, layer) {
                if (feature.properties) {
                    var popupString = '<div class="popup">';
                    for (var k in feature.properties) {
                        var v = feature.properties[k];
                        popupString += k + ': ' + v + '<br />';
                    }
                    popupString += '</div>';
                    layer.bindPopup(popupString);
                }
                if (!(layer instanceof L.Point)) {
                    layer.on('mouseover', function () {
                        layer.setStyle(hoverStyle);
                    });
                    layer.on('mouseout', function () {
                        layer.setStyle(style);
                    });
                }
            }
        }
    );
    map.addLayer(geojsonTileLayer);`

On the line: const geojsonTileLayer = new L.TileLayer.GeoJSON(geojsonURL, {....

I get: TypeError: this._adjustTilePoint is not a function

Thank you

MarinaDrozdovskaya commented 3 years ago

I have the same issue.

darkwood-studios commented 2 years ago

same here...

sirst07 commented 2 years ago

same here...
_adjustTilePoint was removed at leaflet>1.0

jurrian commented 1 year ago

The same problem is mentioned in #39 but it wasn't fixed. As we speak the last change is 7 years ago so it looks rather stale. Leaflet has changed after >0.7 so some changes are needed to make it work.

For whoever feels like continuing on this, start with commenting out these lines: Line 6: this._tiles[tilePoint.x + ':' + tilePoint.y + ':' + tilePoint.z] = tile; Line 26: this._adjustTilePoint(tilePoint); Line 256: L.TileLayer.Ajax.prototype._tileLoaded.apply(this, arguments);

This made it render for me, however it seems that _reset is never triggered so it will keep rendering things on top of each other.