leafgl
leafgl copied to clipboard
Can we draw the polygon borders?
I've seen this issue on the original leaflet.glify, but I'm not sure how to implement it: https://github.com/robertleeplummerjr/Leaflet.glify/issues/14
cheers!
I am not sure either. I think it would be best if you add your request to the issue you mention above. It would surely be nice to have polygon borders.
will do! Oh. and I forgot to thank you for your work on this package. I only found it yesterday and already made my first 60k polygons map. I'm hoping for 1 million now (.canadian postal codes), but I don't want to get my hope to high :)
I think you saw my post about 1.8 mio building footprints on twitter? Depending on polygon comexity you might need to chunk the data. There's also a faster way using data.table described in the inst/experiments folder of this repo.
I am very interested to hear back about any experience with this package so don't be shy to post your experience here.
@SimonCoulombe did you manage to plot the canadian zip codes?
Hi Tim, Thanks for following up! I had to steer my time toward other projects, so mapping the postal codes has been on the back burner for a bit. I'll try to get to it when we get back from the holidays.
Merry Christmas (or holidays, whichever suits you better) :)
The upstream repo has a PR that has stalled a little, but maybe this will be added at some stage.
https://github.com/robertleeplummerjr/Leaflet.glify/pull/32
Hi Tim, still fairly new to github, trying to follow the outcome of issue#3 drawing borders - I would like to be able to draw just polygon borders with no fill. is this possible? thanks
Yes! You just need to st_cast
(assuming you use sf) your polygons to linestrings and then use addGlPolylines
Hi thanks for the quick response,
that works as a sort of workaround, however drawing the linestrings will result in different behavour to the leflet drawing polygons with a boundary
- particularly with click on or hover over polygon attributes?
Would be wonderful if it could work in the same way it does in addPolygons with ability to have separate colour for fill and line for a polygon.
Thanks for all your great work on this project anyway - At least I can render all my polygons!
On Fri, 29 May 2020 at 00:12, tim-salabim [email protected] wrote:
Yes! You just need to st_cast your polygons to linestrings and then use addGlPolylines
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/r-spatial/leafgl/issues/3#issuecomment-635375213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKPWC6ARRPN7DN4XBL7BW3RTZWNFANCNFSM4F7SZUNA .
I got this how I wanted eventually by drawing the ploygons completely transparent ( so I could still clikc on them to get attributes and also drawing the lines. Would be nice to roll into one as in addPolygons though.
When you use mapview with mapviewOptions(platform = "leafgl")
you get both the polygons and the borders. I don't want to make this the default in leafgl, because a fix should not be too far away upstream. I think for making maps "manually" using leaflet et al. it is acceptable to do that one additional step.
I'll leave this open until we have a baked in solution for the polygon borders
+1 for having borders baked in. HTML size is doubled when adding the polyline borders separately, "on top" of the polygons, via a subsequent call to addGlPolylines()
. Guessing this is because all of the geometry is duplicated!
Thank you for all your hard work on this great library!
@dholstius yes the reason for doubling the size is that everything, especially the geometry data, is included twice. If I'm not mistaken, there is already a PR in the upstream repo to allow for drawing borders without having to add the data twice. So the current implementation here is a temporal workaround until we get that functionality cascaded down from upstream Leaflet.glify.