// Calling closestLayerSnap
result = L.GeometryUtil.closestLayerSnap(map, [layer], event.latlng, 10, true);
// Inside: event
// - it's a mousedown event
// - latlng is added as property to the event
event.latlng = {
"lat": 51.50617819737357,
"lng": -0.1680135726928711
};
// Inside: result
// - latlng of the result property
result.latlng = {
"lat": 51.50609608531908,
"lng": -0.16801639863359252
};
// -layer property is equal to the provided layer
result.layer = layer;
// Inside: layer
// - this will be returned by calling "layer.getLatLngs();"
layer._latlngs = [{
"lat": 51.51969,
"lng": -0.15871,
"distance": 553.3263051762495
}, {
"lat": 51.51969,
"lng": -0.15871
}, {
"lat": 51.519639999999995,
"lng": -0.15868,
"distance": 551.487080537704
}, {
"lat": 51.519149999999996,
"lng": -0.15846,
"distance": 537.4476718714111
}, {
"lat": 51.51909,
"lng": -0.15844,
"distance": 534.7195526628889
}, {
"lat": 51.51903,
"lng": -0.15841,
"distance": 533.3216665390597
}, {
"lat": 51.51899,
"lng": -0.15839,
"distance": 532.4143123545797
}, {
"lat": 51.51777,
"lng": -0.15784,
"distance": 497.12976173228657
}, {
"lat": 51.51714,
"lng": -0.15756,
"distance": 479.69260990763655
}, {
"lat": 51.51708,
"lng": -0.15753,
"distance": 477.97175648776573
}, {
"lat": 51.517,
"lng": -0.15749,
"distance": 475.908604671107
}, {
"lat": 51.516960000000005,
"lng": -0.15747999999999998,
"distance": 475.05157614726426
}, {
"lat": 51.516580000000005,
"lng": -0.15729999999999997,
"distance": 464.93440397544254
}, {
"lat": 51.516360000000006,
"lng": -0.15719999999999998,
"distance": 459.30382101611127
}, {
"lat": 51.516070000000006,
"lng": -0.15705999999999998,
"distance": 451.83404032896857
}, {
"lat": 51.51597,
"lng": -0.15700999999999998,
"distance": 449.92888326934514
}, {
"lat": 51.5159,
"lng": -0.15697999999999998,
"distance": 448.0379448216412
}, {
"lat": 51.515550000000005,
"lng": -0.15680999999999998,
"distance": 439.8147337231894
}, {
"lat": 51.5155,
"lng": -0.15677999999999997,
"distance": 438.80291703679455
}, {
"lat": 51.51512,
"lng": -0.15660999999999997,
"distance": 430.11626335213134
}, {
"lat": 51.51503,
"lng": -0.15656999999999996,
"distance": 427.6037885706814
}, {
"lat": 51.514970000000005,
"lng": -0.15653999999999996,
"distance": 426.04342501674637
}, {
"lat": 51.51493000000001,
"lng": -0.15651999999999996,
"distance": 425.8931790954159
}, {
"lat": 51.514540000000004,
"lng": -0.15633999999999995,
"distance": 416.94124286282835
}, {
"lat": 51.51451,
"lng": -0.15632999999999994,
"distance": 416.1838536031882
}, {
"lat": 51.51437,
"lng": -0.15627999999999995,
"distance": 413.0726328383424
}, {
"lat": 51.51424,
"lng": -0.15620999999999996,
"distance": 410.67018396762137
}, {
"lat": 51.51381,
"lng": -0.15600999999999995,
"distance": 402.3940854436109
}, {
"lat": 51.51376,
"lng": -0.15619999999999995,
"distance": 397.4845908963013
}, {
"lat": 51.51369,
"lng": -0.15690999999999994,
"distance": 384.365711269879
}, {
"lat": 51.513659999999994,
"lng": -0.15717999999999993,
"distance": 378.93667017062364
}, {
"lat": 51.51358999999999,
"lng": -0.15777999999999992,
"distance": 367.48333295538725
}, {
"lat": 51.51353999999999,
"lng": -0.15827999999999992,
"distance": 359.6804137008297
}, {
"lat": 51.51349999999999,
"lng": -0.1582699999999999,
"distance": 358.1312608527773
}, {
"lat": 51.513459999999995,
"lng": -0.1582599999999999,
"distance": 357.3583635512117
}, {
"lat": 51.513439999999996,
"lng": -0.1582799999999999,
"distance": 356.58659537341
}, {
"lat": 51.51342999999999,
"lng": -0.1583199999999999,
"distance": 355.95083930228344
}, {
"lat": 51.51340999999999,
"lng": -0.1583399999999999,
"distance": 354.54336829223024
}, {
"lat": 51.51339999999999,
"lng": -0.1583599999999999,
"distance": 353.7711124441904
}, {
"lat": 51.51338999999999,
"lng": -0.15837999999999988,
"distance": 353.1359511576243
}, {
"lat": 51.51332999999999,
"lng": -0.1584399999999999,
"distance": 350.9558376776201
}, {
"lat": 51.513229999999986,
"lng": -0.15856999999999988,
"distance": 345.9609804587795
}, {
"lat": 51.51320999999999,
"lng": -0.15866999999999987,
"distance": 343.91859501922835
}, {
"lat": 51.512849999999986,
"lng": -0.15853999999999988,
"distance": 335.9315406448165
}, {
"lat": 51.512849999999986,
"lng": -0.15858999999999987,
"distance": 335.2745143908198
}, {
"lat": 51.51271999999999,
"lng": -0.15853999999999988,
"distance": 332.18217893198306
}, {
"lat": 51.512709999999984,
"lng": -0.15856999999999988,
"distance": 331.5177219998955
}, {
"lat": 51.51263999999998,
"lng": -0.15854999999999989,
"distance": 329.94848082693153
}, {
"lat": 51.512579999999986,
"lng": -0.1585599999999999,
"distance": 327.79414271765137
}, {
"lat": 51.512509999999985,
"lng": -0.15865999999999988,
"distance": 324.2283146179556
}, {
"lat": 51.51244999999999,
"lng": -0.1587499999999999,
"distance": 321.40317359976393
}, {
"lat": 51.512439999999984,
"lng": -0.15881999999999988,
"distance": 319.3195891266303
}, {
"lat": 51.51242999999998,
"lng": -0.15892999999999988,
"distance": 317.98270393214784
}, {
"lat": 51.51236999999998,
"lng": -0.15905999999999987,
"distance": 314.4932431706602
}, {
"lat": 51.512349999999984,
"lng": -0.15911999999999987,
"distance": 312.41798923877604
}, {
"lat": 51.512349999999984,
"lng": -0.15912999999999988
}, {
"lat": 51.512379999999986,
"lng": -0.1591699999999999
}, {
"lat": 51.51235999999999,
"lng": -0.15948999999999988,
"distance": 307.17584540455
}, {
"lat": 51.512329999999984,
"lng": -0.1595299999999999,
"distance": 305.766250590218
}, {
"lat": 51.512309999999985,
"lng": -0.1595299999999999
}, {
"lat": 51.51217999999999,
"lng": -0.1592999999999999,
"distance": 305.2752856030111
}, {
"lat": 51.51211999999999,
"lng": -0.15925999999999987,
"distance": 303.71203466441693
}, {
"lat": 51.51206999999999,
"lng": -0.15921999999999986,
"distance": 303.64617567161946
}, {
"lat": 51.51204999999999,
"lng": -0.15909999999999985
}, {
"lat": 51.512019999999985,
"lng": -0.15910999999999986,
"distance": 303.5341825890455
}, {
"lat": 51.51198999999998,
"lng": -0.15902999999999987
}, {
"lat": 51.511389999999984,
"lng": -0.15907999999999986,
"distance": 287.17242207426534
}, {
"lat": 51.51114999999999,
"lng": -0.15909999999999985,
"distance": 281.04270138183625
}, {
"lat": 51.510789999999986,
"lng": -0.15911999999999984,
"distance": 271.7075633838705
}, {
"lat": 51.50991999999999,
"lng": -0.15915999999999986,
"distance": 250.76881783826315
}, {
"lat": 51.50936999999999,
"lng": -0.15918999999999986,
"distance": 239.4159560263267
}, {
"lat": 51.50878999999999,
"lng": -0.15919999999999987,
"distance": 228.53008554673934
}, {
"lat": 51.50842999999999,
"lng": -0.15920999999999988,
"distance": 222.69710370815332
}, {
"lat": 51.50798999999999,
"lng": -0.1592499999999999,
"distance": 216.00231480241132
}, {
"lat": 51.50769999999999,
"lng": -0.1592499999999999,
"distance": 212.6405417600322
}, {
"lat": 51.50740999999999,
"lng": -0.15870999999999988
}, {
"lat": 51.506859999999996,
"lng": -0.15767999999999988
}, {
"lat": 51.5066,
"lng": -0.15724999999999986
}, {
"lat": 51.506409999999995,
"lng": -0.15689999999999987
}, {
"lat": 51.50592999999999,
"lng": -0.15610999999999986
}, {
"lat": 51.50551999999999,
"lng": -0.15538999999999986
}, {
"lat": 51.50510999999999,
"lng": -0.15468999999999986
}, {
"lat": 51.504609999999985,
"lng": -0.15386999999999987
}, {
"lat": 51.504159999999985,
"lng": -0.15311999999999987
}, {
"lat": 51.504159999999985,
"lng": -0.15313999999999986
}, {
"lat": 51.504339999999985,
"lng": -0.15411999999999987
}, {
"lat": 51.50461999999998,
"lng": -0.15583999999999987
}, {
"lat": 51.50463999999998,
"lng": -0.15593999999999986
}, {
"lat": 51.50485999999998,
"lng": -0.15718999999999986
}, {
"lat": 51.505229999999976,
"lng": -0.15914999999999985,
"distance": 209.45882650296693
}, {
"lat": 51.50530999999997,
"lng": -0.15955999999999984,
"distance": 199.27117202445515
}, {
"lat": 51.50538999999997,
"lng": -0.15990999999999983,
"distance": 190.91883092036784
}, {
"lat": 51.50549999999997,
"lng": -0.16045999999999982,
"distance": 177.36967046256808
}, {
"lat": 51.50578999999997,
"lng": -0.16168999999999983,
"distance": 147.48898263938224
}, {
"lat": 51.50594999999997,
"lng": -0.16244999999999984,
"distance": 130.13838787997952
}, {
"lat": 51.50603999999997,
"lng": -0.16297999999999985,
"distance": 117.01709276853532
}, {
"lat": 51.50610999999997,
"lng": -0.16347999999999985,
"distance": 106
}, {
"lat": 51.50614999999997,
"lng": -0.16415999999999986,
"distance": 90.0222194794152
}, {
"lat": 51.50614999999997,
"lng": -0.16443999999999986,
"distance": 83.02409288875127
}, {
"lat": 51.50614999999997,
"lng": -0.16488999999999987,
"distance": 73.02739212103907
}, {
"lat": 51.50607999999997,
"lng": -0.16582999999999987,
"distance": 51.0098029794274
}, {
"lat": 51.506069999999966,
"lng": -0.16605999999999987,
"distance": 46.010868281309364
}, {
"lat": 51.506109999999964,
"lng": -0.16905999999999988,
"distance": 24
}, {
"lat": 51.50613999999997,
"lng": -0.16933999999999988
}, {
"lat": 51.50612999999996,
"lng": -0.1693199999999999
}, {
"lat": 51.50613999999997,
"lng": -0.16933999999999988
}, {
"lat": 51.50616999999997,
"lng": -0.16940999999999987
}, {
"lat": 51.50623999999997,
"lng": -0.16949999999999987
}, {
"lat": 51.50637999999997,
"lng": -0.16966999999999988
}, {
"lat": 51.50637999999997,
"lng": -0.1697099999999999
}, {
"lat": 51.50648999999997,
"lng": -0.1697399999999999
}, {
"lat": 51.50711999999997,
"lng": -0.1699899999999999
}, {
"lat": 51.507329999999975,
"lng": -0.1700699999999999
}, {
"lat": 51.507379999999976,
"lng": -0.1700999999999999
}, {
"lat": 51.507599999999975,
"lng": -0.1701299999999999
}, {
"lat": 51.50791999999998,
"lng": -0.17019999999999988
}, {
"lat": 51.508049999999976,
"lng": -0.1702099999999999
}, {
"lat": 51.50951999999997,
"lng": -0.1703499999999999
}, {
"lat": 51.50988999999997,
"lng": -0.1704299999999999
}, {
"lat": 51.510079999999974,
"lng": -0.1705199999999999
}, {
"lat": 51.510239999999975,
"lng": -0.17064999999999989
}, {
"lat": 51.51038999999997,
"lng": -0.1708499999999999
}, {
"lat": 51.51055999999997,
"lng": -0.1711599999999999
}, {
"lat": 51.51072999999997,
"lng": -0.1715599999999999
}, {
"lat": 51.51079999999997,
"lng": -0.1717299999999999
}, {
"lat": 51.51089999999997,
"lng": -0.17190999999999992
}, {
"lat": 51.51097999999997,
"lng": -0.17198999999999992
}, {
"lat": 51.51107999999997,
"lng": -0.17204999999999993
}, {
"lat": 51.51121999999997,
"lng": -0.17208999999999994
}, {
"lat": 51.51139999999997,
"lng": -0.17210999999999993
}, {
"lat": 51.51141999999997,
"lng": -0.17211999999999994
}, {
"lat": 51.511429999999976,
"lng": -0.17194999999999994
}, {
"lat": 51.511359999999975,
"lng": -0.17191999999999993
}, {
"lat": 51.51136999999998,
"lng": -0.17172999999999994
}, {
"lat": 51.51137999999998,
"lng": -0.17133999999999994
}, {
"lat": 51.51137999999998,
"lng": -0.17113999999999993
}, {
"lat": 51.51145999999998,
"lng": -0.16955999999999993
}, {
"lat": 51.51148999999998,
"lng": -0.16843999999999992
}, {
"lat": 51.51155999999998,
"lng": -0.16782999999999992
}, {
"lat": 51.51175999999998,
"lng": -0.1663199999999999
}, {
"lat": 51.51181999999998,
"lng": -0.16584999999999991
}, {
"lat": 51.51184999999998,
"lng": -0.1656999999999999
}, {
"lat": 51.51207999999998,
"lng": -0.1640499999999999
}, {
"lat": 51.51211999999998,
"lng": -0.1634699999999999
}, {
"lat": 51.51206999999998,
"lng": -0.1627699999999999
}, {
"lat": 51.51206999999998,
"lng": -0.16261999999999988
}, {
"lat": 51.51201999999998,
"lng": -0.16234999999999988
}, {
"lat": 51.512099999999975,
"lng": -0.1622199999999999
}, {
"lat": 51.512079999999976,
"lng": -0.1621599999999999
}, {
"lat": 51.51205999999998,
"lng": -0.16200999999999988
}, {
"lat": 51.51206999999998,
"lng": -0.16130999999999987
}, {
"lat": 51.51205999999998,
"lng": -0.16105999999999987
}, {
"lat": 51.51203999999998,
"lng": -0.16081999999999988
}, {
"lat": 51.51208999999998,
"lng": -0.1608299999999999
}, {
"lat": 51.51228999999998,
"lng": -0.15984999999999988
}, {
"lat": 51.51230999999998,
"lng": -0.1598599999999999
}, {
"lat": 51.51237999999998,
"lng": -0.15987999999999988
}, {
"lat": 51.51242999999998,
"lng": -0.1594399999999999
}, {
"lat": 51.512439999999984,
"lng": -0.15917999999999988
}, {
"lat": 51.51245999999998,
"lng": -0.15889999999999987
}, {
"lat": 51.512439999999984,
"lng": -0.15881999999999988
}, {
"lat": 51.51244999999999,
"lng": -0.1587499999999999
}, {
"lat": 51.512509999999985,
"lng": -0.15865999999999988
}, {
"lat": 51.512579999999986,
"lng": -0.1585599999999999
}, {
"lat": 51.51263999999998,
"lng": -0.15854999999999989
}, {
"lat": 51.512709999999984,
"lng": -0.15856999999999988
}, {
"lat": 51.51271999999999,
"lng": -0.15853999999999988
}, {
"lat": 51.512849999999986,
"lng": -0.15858999999999987
}, {
"lat": 51.512849999999986,
"lng": -0.15853999999999988
}, {
"lat": 51.51320999999999,
"lng": -0.15866999999999987
}, {
"lat": 51.513229999999986,
"lng": -0.15856999999999988
}, {
"lat": 51.51332999999999,
"lng": -0.1584399999999999
}, {
"lat": 51.51338999999999,
"lng": -0.15837999999999988
}, {
"lat": 51.51339999999999,
"lng": -0.1583599999999999
}, {
"lat": 51.51340999999999,
"lng": -0.1583399999999999
}, {
"lat": 51.51342999999999,
"lng": -0.1583199999999999
}, {
"lat": 51.513439999999996,
"lng": -0.1582799999999999
}, {
"lat": 51.513459999999995,
"lng": -0.1582599999999999
}, {
"lat": 51.51349999999999,
"lng": -0.1582699999999999
}, {
"lat": 51.51353999999999,
"lng": -0.15827999999999992
}, {
"lat": 51.51358999999999,
"lng": -0.15777999999999992
}, {
"lat": 51.513659999999994,
"lng": -0.15717999999999993
}, {
"lat": 51.51369,
"lng": -0.15690999999999994
}, {
"lat": 51.51376,
"lng": -0.15619999999999995
}, {
"lat": 51.51381,
"lng": -0.15600999999999995
}, {
"lat": 51.51424,
"lng": -0.15620999999999996
}, {
"lat": 51.51437,
"lng": -0.15627999999999995
}, {
"lat": 51.51451,
"lng": -0.15632999999999994
}, {
"lat": 51.514540000000004,
"lng": -0.15633999999999995
}, {
"lat": 51.51493000000001,
"lng": -0.15651999999999996
}, {
"lat": 51.514970000000005,
"lng": -0.15653999999999996
}, {
"lat": 51.51503,
"lng": -0.15656999999999996
}, {
"lat": 51.51512,
"lng": -0.15660999999999997
}, {
"lat": 51.5155,
"lng": -0.15677999999999997
}, {
"lat": 51.515550000000005,
"lng": -0.15680999999999998
}, {
"lat": 51.5159,
"lng": -0.15697999999999998
}, {
"lat": 51.51597,
"lng": -0.15700999999999998
}, {
"lat": 51.516070000000006,
"lng": -0.15705999999999998
}, {
"lat": 51.516360000000006,
"lng": -0.15719999999999998
}, {
"lat": 51.516580000000005,
"lng": -0.15729999999999997
}, {
"lat": 51.516960000000005,
"lng": -0.15747999999999998
}, {
"lat": 51.517,
"lng": -0.15749
}, {
"lat": 51.51708,
"lng": -0.15753
}, {
"lat": 51.51714,
"lng": -0.15756
}, {
"lat": 51.51777,
"lng": -0.15784
}, {
"lat": 51.51899,
"lng": -0.15839
}, {
"lat": 51.51903,
"lng": -0.15841
}, {
"lat": 51.51909,
"lng": -0.15844
}, {
"lat": 51.519149999999996,
"lng": -0.15846
}, {
"lat": 51.519639999999995,
"lng": -0.15868
}, {
"lat": 51.51969,
"lng": -0.15871
}]