Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling points/circles differently from Polygons #280

Open
SamG92 opened this issue Feb 3, 2023 · 0 comments
Open

Styling points/circles differently from Polygons #280

SamG92 opened this issue Feb 3, 2023 · 0 comments

Comments

@SamG92
Copy link

SamG92 commented Feb 3, 2023

Hi there,

I'm loading a protobuf layer of objects containing both polygons and points/circles.
At first load, points/circles are not displayed when creating the vectorGrid using:

vectorGrid = L.vectorGrid.protobuf("https://url/{z}/{x}/{y}.pbf", {
rendererFactory: L.svg.tile,
interactive: true,
minZoom: 15,
maxZoom: 19,
getFeatureId: (f) => {
return f.properties.id;
},
vectorTileLayerStyles: {
item: {
weight: 1,
fill: true,
fillColor: "LightBlue",
fillOpacity: 0.4,
color: 'Gray',
opacity: 0.5,
},
},
})

Capture d’écran 2023-02-03 à 11 06 03

But once the element styles are modified when hovering with mouseover/out event, the circles get styled like polygons and do appear on zoom change (not at the moment they are hovered).
Capture d’écran 2023-02-03 à 11 06 17

I use the following code to handle events:

vectorGrid.on('mouseover', function (e) {
var id = e.layer.properties.id
vectorGridParcelles.setFeatureStyle(id, {
weight: 2,
fillColor: '#999999',
fillOpacity: 1,
fill: true,
color: 'Black',
})
})
vectorGrid.on('mouseout', function (e) {
var id = e.layer.properties.idu
vectorGridParcelles.setFeatureStyle(id, {
weight: 1,
fill: true,
fillColor: "LightBlue",
fillOpacity: 0.4,
color: 'Gray',
opacity: 0.5,
})
})

I read the document which talks about having different set of L.Path options but I can't make it work.
Is there a way to handle that and not display points/circles?

Thanks a lot!

@SamG92 SamG92 changed the title Styling points differently from Polygons Styling points/circles differently from Polygons Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant