maptemplates icon indicating copy to clipboard operation
maptemplates copied to clipboard

Use d3.geoBounds() instead of turf.extent()?

Open jtrim-ons opened this issue 4 years ago • 2 comments

turf.extent(areas)
// [-8.607227544131755,49.91001820137803,1.7629159475701766,60.84535348677859]
d3.geoBounds(areas)
// [[-8.607227544131755,49.91001820137803],[1.7629159475701766,60.84535348677859]]

It looks like we could avoid the 546 kB Turf JavaScript file by using d3.geoBounds.

jtrim-ons avatar Jan 13 '22 11:01 jtrim-ons

Hmmmm... I think the Turf function might run a lot faster than the D3 function. The D3 one does lots of fancy maths: https://www.jasondavies.com/maps/bounds/

jtrim-ons avatar Jan 17 '22 10:01 jtrim-ons

Possibly faster than D3: https://stackoverflow.com/a/35692917

jtrim-ons avatar Jan 17 '22 11:01 jtrim-ons