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

  • SEARCH
  • Home
  • 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 732893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:11:38+00:00 2026-05-14T07:11:38+00:00

I want to draw multiple circles on a map, using the Google Maps API

  • 0

I want to draw multiple circles on a map, using the Google Maps API anj jQuery.
The following code works as long as the line with drawMapCircle() is commented out (The markers are positioned correctly).

What’s wrong with my code?

$.getJSON(
    "ajax/show.php",
    function(data)
    {
        $.each(data.points, function(i, point)
        {
            map.addOverlay(new GMarker(new GLatLng(point.lat, point.lng)));
            drawMapCircle(point.lat, point.lng, 0.01, '#0066ff', 2, 0.8, '#0cf', 0.1);
        });
    }
);

function drawMapCircle(lat, lng, radius, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity)
{
    var d2r = Math.PI / 180;
    var r2d = 180 / Math.PI;
    var Clat = radius * 0.014483;  // statute miles into degrees latitude conversion
    var Clng = Clat/Math.cos(lat * d2r); 
    var Cpoints = []; 

    for (var i = 0; i < 33; i++)
    { 
        var theta = Math.PI * (i / 16);
        Cy = lat + (Clat * Math.sin(theta));
        Cx = lng + (Clng * Math.cos(theta));
        var P = new GLatLng(Cy, Cx);
        Cpoints.push(P);
    }

    var polygon = new GPolygon(Cpoints, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity);
    map.addOverlay(polygon);
}

Javascript throws the following error:

Error: a is undefined
Source: http://maps.gstatic.com/intl/de_ALL/mapfiles/208a/maps2.api/main.js
Line: 317
function Nh(){x(pd).sV();eval(arguments[1])} 
  • 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-14T07:11:39+00:00Added an answer on May 14, 2026 at 7:11 am

    You will need to convert the point values, returned from the ajax call, to float numbers as the google api seems to choke when it receives strings..

    use parseFloat like this

    drawMapCircle(parseFloat(point.lat), parseFloat(point.lng), 0.01, '#0066ff', 2, 0.8, '#0cf', 0.1);

    updated answer
    the actual problem lies in the lines

    Cy = lat + (Clat * Math.sin(theta));
    Cx = lng + (Clng * Math.cos(theta));
    

    addition between string and number yields text..and since both are float numbers, it ends with two . decimal separators, and thus NaN…

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

Sidebar

Ask A Question

Stats

  • Questions 379k
  • Answers 379k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The libsqlite3.dylib library will be a symbolic link to the… May 14, 2026 at 9:26 pm
  • Editorial Team
    Editorial Team added an answer In embedded mode, the Django app is part of the… May 14, 2026 at 9:26 pm
  • Editorial Team
    Editorial Team added an answer Note that the transaction fee that your merchant account provider… May 14, 2026 at 9:26 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.