문제

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??

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top