How to get the user's location from iPhone using Google Maps API v3?

You may want to use the W3C Geolocation API which Safari on the iPhone supports Plotting a point on Google Maps using the position from the Geolocation API, will look something like this: if (navigator. Geolocation) { navigator.geolocation. GetCurrentPosition(function(position) { var point = new google.maps.

LatLng(position.coords. Latitude, position.coords. Longitude); // Initialize the Google Maps API v3 var map = new google.maps.

Map(document. GetElementById('map'), { zoom: 15, center: point, mapTypeId: google.maps.MapTypeId. ROADMAP }); // Place a marker new google.maps.

Marker({ position: point, map: map }); }); } else { alert('W3C Geolocation API is not available'); } Make sure that the Google Maps API v3 is included in your web document: script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript".

You may want to use the W3C Geolocation API, which Safari on the iPhone supports. Plotting a point on Google Maps using the position from the Geolocation API, will look something like this: if (navigator. Geolocation) { navigator.geolocation.

GetCurrentPosition(function(position) { var point = new google.maps. LatLng(position.coords. Latitude, position.coords.

Longitude); // Initialize the Google Maps API v3 var map = new google.maps. Map(document. GetElementById('map'), { zoom: 15, center: point, mapTypeId: google.maps.MapTypeId.

ROADMAP }); // Place a marker new google.maps. Marker({ position: point, map: map }); }); } else { alert('W3C Geolocation API is not available'); } Make sure that the Google Maps API v3 is included in your web document: ... and that you have a placeholder for the map canvas.

One thing to add -- if you are getting the user's location, then you need to pass sensor=true when loading the maps api: – Mark Jul 22 '10 at 16:22 @Mark: Oops you're right. Google really emphasize that. Fixed my answer.

– Daniel Vassallo Jul 22 '10 at 16:45 it is working but that latitude and longitude is wrong – Kandhu Sep 14 '10 at 8:43 @Kandhasamy: Did you give time for the GPS to get a good fix? – Daniel Vassallo Sep 14 '10 at 10:27 no...how can I give time to GPS? – Kandhu Sep 14 '10 at 12:51.

I want to make a google map on the iPhone and show the user's location when they first open the site. But I can't find this method on Google Maps v3 api. So I think maybe the iPhone has the function to do this.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send