Activity Forums Salesforce® Discussions How can I remove the markers that lies outside the circle boundary in Salesforce?

  • Prachi

    Member
    August 8, 2018 at 6:51 am

    I am not sure if the solution I tried is applicable or not.May be the code below will help.

    $(function () {
    var oldArr = [];

    var showNearestLocation = function (distance) {

    var longitude = myloc.lng,
    latitude = myloc.lat;
    var res = leafletKnn(gjLayer).nearest(
    [longitude, latitude], 5, distance);

    diff = oldArr.filter(function (x) { return res.indexOf(x) < 0 });

    for (j = 0; j < diff.length; j++) {
    map.removeLayer(diff[j].layer);
    oldArr.splice(oldArr.indexOf(diff[j]), 1);
    }

    if (distance > 0) {
    if (res.length) {
    map.setView(res[0].layer.getLatLng(), 12);
    for (i = 0; i < res.length; i++) {
    map.addLayer(res[i].layer);

    if ($.inArray(res[i], oldArr) === -1)
    oldArr.push(res[i]);
    }
    }
    }

    }
    var slider = document.getElementById('myRange');
    var output = document.getElementById('demo');
    output.innerHTML = slider.value + scale;

    slider.oninput = function (val) {
    output.innerHTML = this.value + scale;
    circle.setRadius(this.value);
    showNearestLocation(this.value);
    }
    });

    thanks.

  • shariq

    Member
    September 17, 2018 at 11:25 pm

    Hi,

    Could you please provide more detail for your requirement.

    Thanks.

  • Parul

    Member
    September 22, 2018 at 5:54 am

    I didn't understand the question can you explain more.

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos