Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I want to display a Geo-Map and should show the end user's location.
For that I need the latitude and longitude position.
How to get the same from coding.

Kindly guide me on same. I dont know where to start and how to start.
Posted

Hi,

In your application when end user register at that time the user enter his address or not? If no then there should be fields for end user address. Using google api you can find the latitude and longitude from the address.
So you can save that into the database in 2 different column, let`s say lattitude and longitude.
So when you want to show end user geo location then you can show them using saved lattitude and longitude.

I hope it might be help you.

Thanks,
Viprat
 
Share this answer
 
Comments
Arunprasath Natarajan 17-Oct-12 9:16am    
Thank you for your suggestion. But is it possible to track using respective end user IP.
I have solved it myself.
It will be very useful in place of location default display
URL BASED – RETURNS JSON
You have to Pass your IP at the end of this URL.[^]
Coding:
jQuery.getJSON("http://jsonip.appspot.com?callback=?",
function(data){
var clientip = data.ip;
var url ="http://freegeoip.net/json/"+clientip+"?callback=?";
jQuery.getJSON(url, function(data){
$.each(data, function(key, val) {
alert(key+' : '+val);
});
});
}); 


Other method is using database, it will require frequent updation,
above one is better
Other Method
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900