leafgl icon indicating copy to clipboard operation
leafgl copied to clipboard

Can we draw the polygon borders?

Open SimonCoulombe opened this issue 5 years ago • 13 comments

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!

SimonCoulombe avatar Oct 26 '18 17:10 SimonCoulombe

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.

tim-salabim avatar Oct 27 '18 08:10 tim-salabim

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 :)

SimonCoulombe avatar Oct 27 '18 10:10 SimonCoulombe

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.

tim-salabim avatar Oct 27 '18 12:10 tim-salabim

@SimonCoulombe did you manage to plot the canadian zip codes?

tim-salabim avatar Dec 20 '18 10:12 tim-salabim

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) :)

SimonCoulombe avatar Dec 20 '18 13:12 SimonCoulombe

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

tim-salabim avatar Mar 08 '20 17:03 tim-salabim

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

nevilamos avatar May 28 '20 14:05 nevilamos

Yes! You just need to st_cast (assuming you use sf) your polygons to linestrings and then use addGlPolylines

tim-salabim avatar May 28 '20 14:05 tim-salabim

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 .

nevilamos avatar May 29 '20 01:05 nevilamos

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.

nevilamos avatar Jun 02 '20 06:06 nevilamos

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

tim-salabim avatar Jun 02 '20 06:06 tim-salabim

+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 avatar Jan 19 '21 17:01 dholstius

@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.

tim-salabim avatar Jan 19 '21 18:01 tim-salabim