How to find latitude and longitude in node.js?
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