Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:00:31+00:00 2026-06-12T22:00:31+00:00

I have the bellow code checking if a map marker is inside or outside

  • 0

I have the bellow code checking if a map marker is inside or outside of a geofence.

i am going to make it alert detected out of the bounds.

My problem is the map markers a refreshing constantly and i do not want the alert to be repeated over an over.

I need to set something when the alarm is played. Then only do the alert if that thing is unset.

When the user is detected back inside the bounds it will unset it also.

    if (name === f.contact) {
        var fence = new google.maps.LatLng(f.lat, f.lng);
        var dist = google.maps.geometry.spherical.computeDistanceBetween(posi, fence);
        // check if in/out of fence
        if (dist > f.radius) {
            console.log(f.contact+" : "+dist+" meters - outside the fence");
            // OMG outside the fence play an alarm
        } else {
            console.log(f.contact+" : "+dist+" meters - inside the fence");
            // Back inside the fence, reset the alarm
        }
    }

i was thinking possibly making an array like this

var alertSent = [];

and then if outside the geofence adding the users name to it

alertSent.push(name);

how would i check if the name exists in the array?

and how would i delete the name from the array when back inside the fence?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:00:32+00:00Added an answer on June 12, 2026 at 10:00 pm

    You could use an Object as an asociative array and use the names as keys and a boolean value for sent / not sent. alertSent[name] also evaluates to a falsy value if it doesn’t contain name at all.

    var alertSent = {};
    
    // if user outside: check
    if (!alertSent[name]) {
        // show alert
        // remember that alert was shown
        alertSent[name] = true;
    }
    
    // remove name from alertSent:
    
    alertSent[name] = false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to jsf. I have the bellow code. When I place ui:repeat
I have started using struts .I have hanged in a place ,Code is bellow
i have done some code in jquery but where i commented in this bellow
I have a problem while checking a hashtable value. In the code below I
I have a piece of code that is checking to see if a session
I have used below code for checking lastname(case sensitive) from DB. SELECT * FROM
I have a strange scenario here. I have this code: // For checking if
I have the following code for checking internet connection wifi/EDGE/GPRS/3G on my application. the
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below code: class Program { static void Main(string[] args) { Task[] tasks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.