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

Adding labels instead of circle markers for place #67

Open
albanm opened this issue Jan 31, 2017 · 5 comments
Open

Adding labels instead of circle markers for place #67

albanm opened this issue Jan 31, 2017 · 5 comments

Comments

@albanm
Copy link

albanm commented Jan 31, 2017

Hello,

I can't find this in the documentation. Is it possible to add points with some textual property as leaflet labels (or small texts of anykind) instead of markers ?

I guess it should be possible to use the style function to add an item in a label layer instead of returning a style. But I don't see a way to access the coordinates of the point in this function.

Thanks a lot for this awesome project !

@perliedman
Copy link
Member

Hi @albanm,
this is not currently possible - points can be styled as CircleMarkers or Icons, nothing else.

Doing what you propose would be somewhat tricky: VectorGrid uses tiles with SVG or Canvas rendering, and naively adding labels to those would most certainly clip them in an undesirable way. Adding them as normal Leaflet layers would, on the other hand, change much of how VectorGrid basic design (a tile grid).

What I think we could do, is exposing something similar to L.GeoJSON's oneachfeature option, to allow users to hook on any logic they want; for that, we would also need a mechanism so that users can also clean up when features in tiles are removed.

@IvanSanchez
Copy link
Member

@perliedman If a point can be styled with an Icon, can a DivIcon be used instead? If so, there's the text labels.

@perliedman
Copy link
Member

@IvanSanchez no, at the moment we just take the icon image and draw it onto the canvas (or use an SVG image), so we're not even handling shadows or so...

I perceive VectorGrid's primary use case as "render a lot of things with decent performance", and adding one or more DOM elements per feature seems to go against this. But I realize there might be other reasons for using VectorGrid as well.

@albanm
Copy link
Author

albanm commented Jan 31, 2017

Vector tiles are sure great for rendering lots of features. But what I am interested in mostly is client side styling and intelligent simplification. Anyway even with lots of features not all layers are equally dense, for example the 'place' or 'poi' layers in osm tiles are ok.

Providing a hook to let the client add whatever it wants on top of the features in the tiles would be great !

I am willing to work on a PR for this.

@JulieGoldberg
Copy link

Was a workaround for this ever implemented? I'd like to use it if so.

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

4 participants