Basically taking the code from the sample provided by the leaflet website, I am able to get the general map for leaflet:

basic leaflet

Now, I would like to add reference lat/lon lines. For example, 0, 10, 20, ... 90 degrees (East and West), and then also lines of longitude. There are examples of how to generate general lines connecting two points where I could, for example, get the International Date Line:


Now, if I wanted to add multiple lat/lons lines, I would basically need to create an entire new var to add, something like:

var ll1 = L.polygon([[-90,-180],[90,-180]]).addTo(map)
var ll2 = L.polygon([[-90,-170],[90,-170]]).addTo(map)
var ll3 = L.polygon([[-90,-160],[90,-160]]).addTo(map)

Is there an easier / more compact way to get all lat/lons at, for example, a 10-degree step between lines?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.