Leaflet / Leaflet/Leaflet.VectorGrid

Low precision interation with L.vectorGrid.protobuf

Open
#211 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
676
Forks
202
PR merge metrics
No merged PRs in 30d

Description

I am using L.vectorGrid.protobuf with rendererFactory: L.canvas.tile to show some vectortiles generated with tippecanoe.

Everything looks nice and fast, but the interactive:true option lacks some precision for some polygons.

You can see this happening on this gif:
http://sigserver3.udg.edu/map-vectortiles/low-precision-interaction.gif

all polygons are drawn (even small ones) but some of them are not detected when onclick event occurs, so and adjacent polygon is selected instead.

Also, you can try it by yourself here:
http://sigserver3.udg.edu/map-vectortiles

Any idea why this is happening? And better yet, how to solve it?

I have also tryed the SVG renderer with no problems, but there are too many polygons and everything goes very slow. My only option is to use CANVAS rendererFactory.

Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the interaction issue in L.vectorGrid.protobuf with rendererFactory: L.canvas.tile and interactive:true using the linked map example. Compare polygon hit detection with the SVG renderer and inspect the canvas interaction path. Done means small polygons consistently select themselves without making the canvas renderer unacceptably slow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.