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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:21:12+00:00 2026-06-18T05:21:12+00:00

how to get array of polyline coordinates from google.maps.Circle ‘s object there is no

  • 0

how to get array of polyline coordinates from google.maps.Circle‘s object

enter image description here

there is no api doc entry about that

  • 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-18T05:21:13+00:00Added an answer on June 18, 2026 at 5:21 am

    A google.maps.Circle doesn’t contain an array of coordinates. If you want a google.maps.Polygon that is shaped like a circle, you need to make one.

    function drawCircle(point, radius, dir) { 
      var d2r = Math.PI / 180;   // degrees to radians 
      var r2d = 180 / Math.PI;   // radians to degrees 
      var earthsradius = 3963; // 3963 is the radius of the earth in miles
    
      var points = 32; 
    
      // find the raidus in lat/lon 
      var rlat = (radius / earthsradius) * r2d; 
      var rlng = rlat / Math.cos(point.lat() * d2r); 
    
      var extp = new Array(); 
      if (dir==1) {
         var start=0;
         var end=points+1; // one extra here makes sure we connect the path
      } else {
         var start=points+1;
         var end=0;
      }
      for (var i=start; (dir==1 ? i < end : i > end); i=i+dir)  
      { 
         var theta = Math.PI * (i / (points/2)); 
         ey = point.lng() + (rlng * Math.cos(theta)); // center a + radius x * cos(theta) 
         ex = point.lat() + (rlat * Math.sin(theta)); // center b + radius y * sin(theta) 
         extp.push(new google.maps.LatLng(ex, ey)); 
      } 
      return extp;
    }
    
    var circle = new google.maps.Polygon({
                   map: map,
                   paths: [drawCircle(new google.maps.LatLng(-33.9,151.2), 100, 1)],
                   strokeColor: "#0000FF",
                   strokeOpacity: 0.8,
                   strokeWeight: 2,
                   fillColor: "#FF0000",
                   fillOpacity: 0.35
    });
    

    Example

    code snippet:

    function drawCircle(point, radius, dir) {
      var d2r = Math.PI / 180; // degrees to radians 
      var r2d = 180 / Math.PI; // radians to degrees 
      var earthsradius = 3963; // 3963 is the radius of the earth in miles
    
      var points = 32;
    
      // find the raidus in lat/lon 
      var rlat = (radius / earthsradius) * r2d;
      var rlng = rlat / Math.cos(point.lat() * d2r);
    
    
      var extp = new Array();
      if (dir == 1) {
        var start = 0;
        var end = points + 1
      } // one extra here makes sure we connect the
      else {
        var start = points + 1;
        var end = 0
      }
      for (var i = start;
        (dir == 1 ? i < end : i > end); i = i + dir) {
        var theta = Math.PI * (i / (points / 2));
        ey = point.lng() + (rlng * Math.cos(theta)); // center a + radius x * cos(theta) 
        ex = point.lat() + (rlat * Math.sin(theta)); // center b + radius y * sin(theta) 
        extp.push(new google.maps.LatLng(ex, ey));
        bounds.extend(extp[extp.length - 1]);
      }
      // alert(extp.length);
      return extp;
    }
    
    var map = null;
    var bounds = null;
    
    function initialize() {
      var myOptions = {
        zoom: 10,
        center: new google.maps.LatLng(-33.9, 151.2),
        mapTypeControl: true,
        mapTypeControlOptions: {
          style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
        },
        navigationControl: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
    
      bounds = new google.maps.LatLngBounds();
    
      var donut = new google.maps.Polygon({
        paths: [drawCircle(new google.maps.LatLng(-33.9, 151.2), 100, 1),
          drawCircle(new google.maps.LatLng(-33.9, 151.2), 50, -1)
        ],
        strokeColor: "#0000FF",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#FF0000",
        fillOpacity: 0.35
      });
      donut.setMap(map);
    
      map.fitBounds(bounds);
    }
    google.maps.event.addDomListener(window, 'load', initialize);
    html,
    body,
    #map_canvas {
      width: 100%;
      height: 100%;
      padding: 0px;
      margin: 0px;
    }
    <script src="https://maps.google.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk"></script>
    <div id="map_canvas"></div>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Loop through JavaScript object Get array of object’s keys Is there a
I need to get array of images that have to call from server and
How to get array data from json in c#? Here is the ajax code
Is there a simple way to get array of all index paths for the
Scenario: If there is an array of integers and I want to get array
I get an array (containing text) called titleArray from json which I populate a
Get object 's array value in php $obj = new Basecamp($bcUrl, $bcApikey, 'X', 'simplexml');
how can i get array value from php to javascript, and use the value
I have an array of reflectionClasses. I need to get a reflectionObject from one
Is there a way in smarty to get array element, if key ends with

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.