Question

I am trying to build a geolocation based app. The pre-requisite for such an app is getting an accurate geolocation of the user. Using HTML5 this can be done as follows:

  if (navigator.geolocation) {
          var timeoutVal = 10 * 1000 * 1000;
          navigator.geolocation.getCurrentPosition(
              displayPosition, 
              displayError,
              { enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 }
          );
      }

But If the browser only has the IP address then it will be very inaccurate. This article refers to that as well. In that case, just for the sake of accuracy, I want my users to locate their location, via a map interface.

  1. Show the users a google map instance.

  2. Ask them to add markers to their current position.

  3. When that is done, send a post request to the server.

I found one library jquery ui maps but how to take input from the user on the google map canvas is not specified. Can someone please help me taking inputs from the user on the google maps canvas??

Was it helpful?

Solution

If you want to use jquery maps just look at this example and replace findLocation function with code to store geo coordinates.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top