Skip to content

Commit 58bbede

Browse files
committed
почта - разнесение точек с одинаковыми координатами
1 parent 3cdc651 commit 58bbede

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

russian_post/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@
401401
a.id = 'rp'+a.ref
402402
if (!circles[a.id])
403403
{
404+
a.lat = fix_latlon(a)
404405
let color = a.opening_hours == 'closed' ? colors.rp_closed : colors.rp
405406
circles[a.id] = L.circleMarker(a, {radius: 3, color, weight: 1})
406407
.bindPopup('', { data: a }).addTo(map)
@@ -418,6 +419,23 @@
418419
$('info', msg)
419420
}
420421

422+
/** не ставим точки в одно и то же место */
423+
function fix_latlon(a)
424+
{
425+
if (!a.lat) return a.lat
426+
427+
var lat = parseFloat(a.lat), hash = _=>lat+''+a.lon
428+
if (!window.latlon) window.latlon = {}
429+
let aa=1
430+
while (window.latlon[hash()])
431+
{
432+
lat -= 0.5/10000
433+
if (aa++>10) break;
434+
}
435+
window.latlon[hash()] = 1
436+
return lat
437+
}
438+
421439
var g_moveInterval = 0
422440
map.on('moveend', _=>{
423441
clearInterval(g_moveInterval)

0 commit comments

Comments
 (0)