Adding a square polygon of a set size around a point using leaflet.js

Viewed 2157

Bit of a weird one I hope someone can help out with.

In leaflet, once the user has entered a lat/lng and added a point to the map I want to be able to also add a 10km square around that point.

I've tried looking around for a calculation to find the corners of the square x Km away but haven't dug anything up. But surely there's an easier way!

Does anyone have any thoughts? It'd be lovely to just say L.polygon then pass in a centre point and a square size.

Thanks,

Tayler

1 Answers
Related