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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:58:13+00:00 2026-06-13T06:58:13+00:00

Ok, so I’m using the Google Maps API for my website, and am making

  • 0

Ok, so I’m using the Google Maps API for my website, and am making use of the ‘Set Current Location’ function.

It works fine for some users, but for others, it’s defaulting to the ‘wrong’ location.

Example 1
I got a friend to test the site whilst in our student house in Liverpool.
When he Allows Current Location, it sets his location as his family home in Stafford, which is wayyyy off.

Example 2
Whilst at a University computer, I tested the website and allowed the Current Location feature. This time, it set the location to the building where the University’s servers are located, as opposed to the location of the computer (on the other side of Liverpool!)

I don’t know enough about IP geolocation, so can’t think of a solution, nor can I find any similar stackoverflow questions.
Is there a way to set the location in a more accurate way? Perhaps I could set the location using a postcode?

Any help would be appreciated.

Tristan

EDIT:
This is the code I have for setting the location, inside the initialize function

if(navigator.geolocation) {

         navigator.geolocation.getCurrentPosition(currentPositionCallback);

        } else {

        alert('The browser does not support geolocation');

        }

    function currentPositionCallback(position) {

         // Create a new latlng based on the latitude and longitude from the users position
         var user_lat_long = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

         // Add a marker using the user_lat_long position
         var userpos = new google.maps.Marker({
         position: user_lat_long,
          icon: new google.maps.MarkerImage("img/icons/icon_home.png", new google.maps.Size(32, 34)),
         map: map
         });

         // Set the center of the map to the users position and zomm into a more detailed level
         map.setCenter(user_lat_long);
         map.setZoom(15);

    }
  • 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-13T06:58:14+00:00Added an answer on June 13, 2026 at 6:58 am

    The problem is that geolocation is a bit of a dark art. The API uses a number of techniques to work out where it is.

    • The most reliable is if the machine has GPS. This can narrow you down to the nearest ten metres or so.
    • Next, mobile phones can do some work by reporting what cell masts are in the area and the signal strengths. This can be used to triangulate you to within a hundred metres or so.
    • Another method is to look at the IP address. These can be mapped to a geographic location, but it tends to be very very inaccurate. This technique would only be used if your machine has no other method of geolocation. This might explain the cross-town effect with the University computer.
    • The final method (which I think is at play for your friend) is looking at WiFi networks in the area. You remember Google got in trouble a couple of years ago for slurping data off people’s WiFi? Well the reason they were looking at the WiFi in the first place was to get a map of WiFi routers. They know the names and locations of every WiFi router in the country (well, nearly all of them). The browser supplies a list of signals it can see, and Google can work out pretty accurately where you are.

    If you’re using a standard laptop, the odds are that the only method that can be used is this final one. This works well, provided Google’s database is up-to-date.

    Unfortunately, it can be inaccurate. People are always setting up new routers, upgrading, changing the WiFi details, moving house and taking routers with them, or even just switching them on or off.

    If the signals that are detected around your PC don’t match those that Google thinks are in your location, then expect odd results. My guess is that your friend has taken a router with him from his home to his student digs? Google probably recognises that router as being from Stafford, and doesn’t recognise any of the others in the area (because all the students have changed since they last did a scan), and so it guesses that it must be in Stafford.

    When it works, this technique is frighteningly accurate, but when it doesn’t, the results can be comically inaccurate. Short of installing a GPS beacon in your laptop, or persuading everyone in your neighbourhood never to change their routers, there’s not much you can do about it one way of the other.

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the

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.