Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find latitude and longitude in node.js?

I am working on web analytics, we are using node.js in server side, we are sending the data using http request(express framework).

Requirement:Have to find the latitude and longitude of the visitor.

My question is how to find the latitude and longitude in node.js? Any framework available?

like image 678
karthick Avatar asked May 02 '13 10:05

karthick


1 Answers

I strongly recommend to use the HTML5 geolocation API inside the browser and then send visitor location information to your server – that's way more accurate than using geolocation from IP addresses on the server-side. You will be getting the location of the ISPs, which can be quite far away, and in addition the IP-to-location databases aren't always up to date with the latest changes, so you might won't get any data for a particular IP address.

To find out more about this topic take a look at MaxMind, which offers a popular IP-to-location database published some statistics on its database: GeoIP City Accuracy for Selected Countries

Here's a great example of using navigator.geolocation:

  • Real-Time Geolocation Service with Node.js
like image 84
dom Avatar answered Nov 20 '22 05:11

dom