x = lng/360 + 0.5; siny = Math.sin(Math.toRadians(lat)); y = 0.5 * Math.log((1 + siny) / (1 - siny)) / -(2 * Math.PI) + .5;
As per the code this is conversion of (lng, lat) to mercator
Result of above formula for spatial point
(-122.43499755859375, 37.71860885620117) is
If I use PostGIS to convert same point to projection 3857 result is
Why is there a difference? Leaflet clustering works well with above formula if I have to achieve similar result with PostGIS what kind of projection I must use? Or any more calculations required based on 3857 projection?