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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:14:36+00:00 2026-05-16T12:14:36+00:00

I am working on a project in javascript involving google maps. The goal is

  • 0

I am working on a project in javascript involving google maps.

The goal is to figure out 16-20 coordinate points within n kilometers from a set of latitude longitude coordinates such that the 16 points if connected will form a circle around the original coordinates.

The end goal is to make it so I can figure out coordinates to plot and connect on google maps to make a circle around a given set of coordinates.

The code would go something like:

var coordinates = Array();
function findCoordinates(lat, long, range) {
}
coordinates = findCoordinates(-20, 40, 3);

Now to make the magic happen in the findCoordinates() function.

  • 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-16T12:14:37+00:00Added an answer on May 16, 2026 at 12:14 pm

    Basically what you’re trying to do is find N points on the radius of a circle from a given point with a given radius. One simple way of doing it is splitting the 360 degrees of a circle in to N equal chunks, and finding the points at regular intervals.

    The following should do roughly what you’re after –

    function findCoordinates(lat, long, range)
    {
        // How many points do we want? (should probably be function param..)
        var numberOfPoints = 16;
        var degreesPerPoint = 360 / numberOfPoints;
    
        // Keep track of the angle from centre to radius
        var currentAngle = 0;
    
        // The points on the radius will be lat+x2, long+y2
        var x2;
        var y2;
        // Track the points we generate to return at the end
        var points = [];
    
        for(var i=0; i < numberOfPoints; i++)
        {
            // X2 point will be cosine of angle * radius (range)
            x2 = Math.cos(currentAngle) * range;
            // Y2 point will be sin * range
            y2 = Math.sin(currentAngle) * range;
    
            // Assuming here you're using points for each x,y..             
            p = new Point(lat+x2, long+y2);
    
            // save to our results array
            points.push(p);
    
            // Shift our angle around for the next point
            currentAngle += degreesPerPoint;
        }
        // Return the points we've generated
        return points;
    }
    

    The array of points you get back can then easily be used to draw the circle you wish on your google map.

    If your overall goal however is just to draw a circle at a fixed radius around a point, then a far easier solution may be to use an overlay. I’ve found KMBox to be very easy to set up – you give it a central point, a radius and an image overlay (in your case, a transparent circle with a visible line around the edge) and it takes care of everything else, including resizing it on zoom in/out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a personal project involving some jQuery / native Javascript programming.
I am currently working on a php/javascript project which retrieves information from a database
I'm working on a personal project involving Javascript, and as part of that project,
I'm currently working on a JavaScript project that uses the HTML5 canvas as a
I am working on a javascript project which involves parsing xml data. I have
I'm working on a security project in Javascript (something I honestly have not used),
I'm working on a project and trying to use JavaScript for validating all inputs
while working on a school project i ran into a problem using javascript to
I'm working on a large project that is organized like so: Multiple javascript files
I am working on a project in which javascript files are dynamically loaded into

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.