I have seen few examples of using geoip in node.js such as https://github.com/kuno/GeoIP.git and https://github.com/wadey/node-geoip. However what i want is to display the map showing geoip for the particular loged in user.How can it be implemented.
MaxMind periodically tests the accuracy of the data used in GeoIP2 products and services. Accuracy is calculated by checking known web user IP address and location pairs against the data within MaxMind's GeoIP2 web service as well as the GeoIP2 City and GeoLite2 City database offerings.
What is an IP Geolocation Database? Geolocation IP Databases allow you to determine your website visitor's location. These databases of IP addresses contain the latitude and longitude of a particular IP address.
You can get a geolocation database (such as from http://www.maxmind.com) and store it in mongo. Each record contains an IP range (start/end) and the latitude/longitude associated with that IP range. IPs are represented as integers. You could create an index on the start
field, and do a query on mongo to find the record with the largest value of start
which is smaller than the IP of your client user, and look up the corresponding lat/lon.
As for plotting a map with this lat/lon, it's very easy to create a google map which is centered on a particular location: (View source at: http://code.google.com/apis/maps/documentation/javascript/v2/examples/map-simple.html)
There are a lot of different ways of storing/querying geolocation data, but this is just one possible approach using mongo that might work. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With