Leaflet / Leaflet/Leaflet.VectorGrid
Uncaught TypeError: Cannot read properties of undefined (reading 'lat')
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 676
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
I have tried to implement the onClick event using this plugin as below,
const vectorGrid = L.vectorGrid
.slicer(street, {
rendererFactory: L.svg.tile,
maxNativeZoom: 19,
maxZoom: 20,
interactive: true,
getFeatureId: function (f) {
return f.properties.name;
},
})
.on("click", function (e) {
console.log(e);
})
.addTo(map);
When I clicked the layer, it shows the following error,
Uncaught TypeError: Cannot read properties of undefined (reading 'lat')
at Object.project (Projection.SphericalMercator.js:24)
at Object.latLngToPoint (CRS.js:28)
at i.project (Map.js:993)
at i.latLngToLayerPoint (Map.js:1015)
at i.latLngToContainerPoint (Map.js:1072)
at i._fireDOMEvent (Map.js:1434)
at i._handleDOMEvent (Map.js:1397)
at HTMLDivElement.c (DomEvent.js:92)
In this error log, I didn't find the error linked to my vector grid file. Please help me how can I solve this issue?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the click from the provided JavaScript vector-grid snippet with interactive enabled, then trace the event through Map.js and DomEvent.js into Projection.SphericalMercator.js. Determine why the click path receives an undefined latitude or coordinate, and confirm the issue is resolved when the click event completes without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100