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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:04:23+00:00 2026-05-24T10:04:23+00:00

I have the below in a google map application and want to display the

  • 0

I have the below in a google map application and want to display the elevation converted to feet but how do I round up/down to the nearest number? (eliminate digits after the decimal) I tried the number.toFixed(x) method but nothing seemed to do it.

function getElevation(event) {

    var locations = [];
    var clickedLocation = event.latLng;
    locations.push(clickedLocation);
    var positionalRequest = { 'locations': locations }

    // Initiate the location request
    elevator.getElevationForLocations(positionalRequest, function(results, status) {
      if (status == google.maps.ElevationStatus.OK) {

        // Retrieve the first result
        if (results[0]) {

          // Open an info window indicating the elevation at the clicked position
          infowindow.setContent("The elevation at this point <br/>is " + results[0].elevation*(3.2808399) + " feet.");
          infowindow.setPosition(clickedLocation);
          infowindow.open(map);
        } else {
          alert("No results found");
        }
      } else {
        alert("Elevation service failed due to: " + status);
      }
    });
  }
  • 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-24T10:04:24+00:00Added an answer on May 24, 2026 at 10:04 am

    If you want to round to the nearest integer, simply use Math.round(x)

    Math.round(25.9)  //returns 26
    Math.round(25.2)  //returns 25
    Math.round(-2.58) //returns -3
    

    You may also want to look into Math.floor (always rounds down), and Math.ceil (always rounds up).

    I’ve put together a Fiddle that demonstrates all three methods: jsFiddle

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

Sidebar

Related Questions

I have the below static google map url. just want to know the equivalent
I'm new at this, but I have a Google V3 map that loads from
I have some problem to get lat/lng from google map in my application. When
I have a present need to display a Google Map, inside a FancyBox. The
I have used below code for displaying multiple marker in the google map and
I have a Google map that is showing a number of markers. When the
I have an application which is currently using the google map API. I like
Am displaying a google map and below it have a text input where am
I have a url that returns XML coordinates in the below format. I want
I am trying to display google map as a tooltip using qTip jquery plugin.

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.