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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:53:39+00:00 2026-05-22T20:53:39+00:00

I have create a site embedded Google mapusing api V3 that shows our 4

  • 0

I have create a site embedded Google mapusing api V3 that shows our 4 offices, you can then type your postcode and check the distance between you and an office, this works!

I want to now create a radial search, I’ve found how to do it online, which is great and am on the final hurdle and this is where I need your help if possible.

I have the following:

        geocoder = new google.maps.Geocoder(); // creating a new geocode object

    // getting the two address values
    address1 = document.getElementById("addresses1").value;
    distance1 = document.getElementById("distance").value;

    // finding out the coordinates
    if (geocoder) 
    {
        geocoder.geocode( { 'address': address1}, function(results, status) 
        {
            if (status == google.maps.GeocoderStatus.OK) 
            {
                //location of first address (latitude + longitude)
                location1 = results[0].geometry.location;

                // Location Marker
                var marker = new google.maps.Marker({
                  map: map,
                  position: location1,
                  title: 'Random text'
                });
                // Add circle overlay and bind to marker
                var circle = new google.maps.Circle({
                  map: map,
                  radius: distance1,
                  strokeWeight: 0,
                  fillColor: '#AA0000'
                });
                circle.bindTo('center', marker, 'position');


            } else 
            {
                alert("Geocode was not successful for the following reason: " + status);
            }
        });
    }

I have managed to get everything working except for $distance1. What should happen is, the user selects the distance from a form: say 10 miles (set in meters for Google Maps) when they hit submit, a circle is drawn with a radius of 10 miles.

As the code stands, the point is drawn but, the circle does not appear.

If I replace distance1 = document.getElementById("distance").value; with distance1 = 16999; for example, then a circle appears and it works perfectly.

To me this must mean that there is something wrong with the content of distance1 when it is being pulled from the form. I have done a NaN test just to be sure and it reports that the content is a number.

My question is (in a very long winded way – sorry about that) do you have any idea how to get distance1 to have a value from the form.

// Add circle overlay and bind to marker
var circle = new google.maps.Circle({
map: map,
radius: distance1,
strokeWeight: 0,
fillColor: '#AA0000'
});

The part in question is radius: distance1

  • 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-22T20:53:40+00:00Added an answer on May 22, 2026 at 8:53 pm

    Might help to make sure it is a number, not a string.

    distance1 = parseFloat(document.getElementById("distance").value);
    

    (parseInt would probably work fine as well, since it is in meters and fractional meters won’t make much difference)

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

Sidebar

Related Questions

I have to create a site definition for a client that must contain pre-defined
I have a simple PowerShell script that uses WMI to create a web site
I have some code that creates a new site in SharePoint. Upon browsing to
I have some code on my PHP powered site that creates a random hash
I have to create a dialog based application, instead of old CFormView type of
I'm trying to create a site where, like Digg, a user can submit a
I have to create a basket/checkout page for an E-commerce site. With all these
i have to create one asp.net mvc page that will show template of controls.
Just starting out in asp.net. Have just created a login.aspx page in my site
This is what I currently have: CREATE OR REPLACE TRIGGER MYTRIGGER AFTER INSERT ON

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.