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 7050787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:11:12+00:00 2026-05-28T03:11:12+00:00

I have markers dotted around a map, and a radius (circle overlay) on a

  • 0

I have markers dotted around a map, and a radius (circle overlay) on a marker marking your location (which changes every time you move).
Is there any way I can check to see if the other markers come inside the circle?

UPDATE

I got around this by looping through each other marker, and using the geometry library calculating the distance between your marker and the other marker and then a simple if statement to see if it’s less than 100 meters.

function checkAllChests() {
    var Current = 0;
    $.each(treasureArray, function() {
        //var thisLocation = treasureArray[Current].getPosition();

        var distanceBetween = Math.ceil(google.maps.geometry.spherical.computeDistanceBetween(treasureArray[Current].getPosition(), marker_me.getPosition()));
        if(distanceBetween < 100) {
            alert('CAN OPEN THIS CHEST');
        }
        Current++;
    });
}

I’d like to note that the above code uses jQuery, so if you aren’t using jQuery it won’t work.

  • 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-05-28T03:11:12+00:00Added an answer on May 28, 2026 at 3:11 am

    Here’s a way to add a contains method to the google.maps.Circle class. It first uses the bounding box to exclude a point if it’s not even in the bounding box. If it is in the bounding box, then it compares the distance from the point to the center with the radius, and returns true only if the distance is shorter than the radius.

    Once you add the javascript below, you can call the contains() method on your circle object.

    google.maps.Circle.prototype.contains = function(latLng) {
      return this.getBounds().contains(latLng) && google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(), latLng) <= this.getRadius();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a map with multiple markers, which I populate via an array. Each
I have markers in two marker layers,which i need to keep separate, so I
I have activity which can show overlay. This overlay have markers which gets from
I have lot of markers on my map. Zooming in each marker shows me
I have a map that dispays markers. If the user clicks on a marker
I have the following piece of code which replaces template markers such as %POST_TITLE%
I have a map with 4 layers, each layer having markers for various shops.
I have a rather large SQL file which starts with the byte order marker
I understand that if I have multiple markers on a map, and I need
I have several markers on one map, I also have several links and I

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.