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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:59:10+00:00 2026-06-15T02:59:10+00:00

I am currently using html 5’s geo location feature. Everything works and its a

  • 0

I am currently using html 5’s geo location feature. Everything works and its a good feature. However, as counter intuitive this may sound, I want the location which it obtains to be less accurate.

At the moment, it is getting my exact location, and, due to data privacy, I dont want this. Is there a way to make it less accurate ?

I am currently trying to create a function called getRandomGeoValue, shown below:

function getRandomGeoValue(geoValue)
{


}

The function takes a geo value (either latitude or longitude) and returns an random inaccurate geo value. I am trying to use Javascripts Math.random() function, but the result is way too inaccurate.

Ideally, the inaccuracy would be around 17 miles.

  • 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-15T02:59:11+00:00Added an answer on June 15, 2026 at 2:59 am

    You could take the current location (presumably latitude and longitude) and apply one of several transformations to it:

    1. Round it to the nearest 10 miles (or whatever level of accuracy you want)
    2. Round each latitude and longitude value to the nearest 10 seconds (or whatever level of accuracy you want)
    3. Add a random value to both the latitude and longitude that makes it +/- 5 miles (or whatever level of accuracy you want).

    If your lat/long values are in degrees, then you can round it to the nearest N miles with this function:

    function roundPosition(lat, lon, roundMiles) {
        // 69.11 miles per degree of latitude
        var roundFactor = 69.11 / roundMiles;
        lat = Math.round(lat * roundFactor) / roundFactor;
    
        // miles in 1 degree of longitude = 69.11 * cos(latitude in radians)
        var latRadians = (lat / 180) * Math.PI;
        var milesPerDegreeLong = 69.11 * Math.cos(latRadians);
        roundFactor = milesPerDegreeLong / roundMiles;
        lon = Math.round(lon * roundFactor) / roundFactor;
        return({latitude: lat, longitude: lon});
    }
    

    This function returns an object with the new rounded latitude and longitude as properties.

    Example usage:

    var latitude = 69.2;
    var longitude = 180.9;
    var newPos = roundPosition(latitude, longitude, 17);
    // newPos.latitude and newPos.longitude contain the new rounded values
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using this DOCTYPE: <!DOCTYPE HTML SYSTEM> However, when I validate my
I am currently matching HTML using this code: preg_match('/<\/?([a-z]+)[^>]*>|&#?[a-zA-Z0-9]+;/u', $html, $match, PREG_OFFSET_CAPTURE, $position) It
My site is currently using: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> However,
This is the HTML code: <div class=test onclick=$(this).vote('<$>votehash</$>', null, event)></div> I am currently using
I am currently using the Html.EditorFor<> method for generating editor fields, however I would
I am using @Html.ActionLink(Home, Home) to currently pass back to Home when clicked. However,
I'm currently using popovers with Twitter Bootstrap, initiated like this: $('.popup-marker').popover({ html: true, trigger:
I've currently got a View like this: @using (Html.BeginForm(Compare, Carousel, FormMethod.Post)) { @foreach (var
Currently I'm using this: HTML: <div id=container> <img src=x.jpg id=bg /> <div id=content> <h1>Welcome
I'm currently using this to get the class for a specific bit of HTML

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.