Leaflet / Leaflet.VectorGrid

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

Highlight feature and bring to front #185

Open RGregat opened 5 years ago

RGregat commented 5 years ago

Hi, I have one question regarding the highlighting of a feature. Currently I have the problem, that parts of a geometry are overlapped by other geometries. That means, that parts of the highlighted feature are not visible.

map-export

Is it possible to put the highlighted feature to the front, or just create a copy of the feature?

mngyng commented 5 years ago

Do you have a composite layer, like, having a country border outside of the states border and published them as one vector tile layer? If so, I'm guessing this is a similar issue with #167. Tell me if that sounds promising. I have a yet-to-polish workaround codes for that matter.

revatim commented 5 years ago

Is this fixed? I am facing the same issue.

mngyng commented 5 years ago

Is this fixed? I am facing the same issue. Well I posted a workaround in #167, not sure if that solves your problem. If you're asking for a fix in a latest version of VectorGrid, I don't think they fixed the problem so far.

tottile commented 2 years ago

I have a suggestion for a simple bugfix:

editing to the function setFeatureStyle in https://github.com/Leaflet/Leaflet.VectorGrid/blob/master/src/Leaflet.VectorGrid.js by adding the line

feature.feature.bringToFront();

right after

this._updateStyles(feature.feature, tile, styleOptions);

should fix the problem.

UPDATE: I created a pull request Fix issue 185