1

I want to plot multi markers on Leaflet like a grid map. We often seen icons based on pixel size, but I couldn't find case that used lat/lon-sized(e.g. 0.5 degree) icons. What should I do?

↓In the ordinary way, icon-size base on pixel...

var myIcon = L.Icon.extend({
options: {
    iconSize:       [20, 20],
    iconAnchor:     [10, 10],
    popupAnchor:    [0, -10]
    }
});
2

Doing markers in other units is probably technically possible, but not advisable or practical.

The main advantage of pixels as a measurement that the symbols remain the same size as you zoom in and out (change the scale).

If you choose meters or degrees, this doesn't happen. When zoomed into a town, a degree-sized symbol would be larger than the screen.

If you use (for example) 10km as the marker size, these would be dots when fully zoomed out. So you'd need to change the size for each zoom level.

A second issue - specific to degrees - is that a degree of longitude is longer near the equator than at the poles. This means your symbols will shrink or distort the further away from the equator you are.

Add to this the fact that you'd need Leaflet to do all the formulae for each marker, and account for zoom level/scale, it's probably best to stick with pixels :)

  • Thank you for your kindness!!! I beg your pardon, I really want to make grid map like this ←I made this drawing used by illustrator... Map might be Equirectangular projection, problem of poles will be solved. Can I make icon size that base on degree? I am sorry for inquisitive.... – aaaa Sep 10 '18 at 10:10
  • 1
    Then you don't want markers, and this is either an instance of the XY problem or just a bad choice of words. You probably will want either a vectorial square grid and then some geoprocessing on your source data, or rasterize your source data into a very low-res raster. Please edit your question to provide more background (what kind of data you have, what are you trying to achieve). – IvanSanchez Sep 10 '18 at 10:35
  • I sort of saw that using like GeoJSON would be most suitable. But I don't understand anything for GIS.... Should I open up a new question? – aaaa Sep 10 '18 at 11:13
  • 1
    Please pay attention to gis.stackexchange.com/help/how-to-ask . Editing this question or opening a new one is up to you. – IvanSanchez Sep 10 '18 at 11:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.