找到位置的最佳node.js模块? [英] Best node.js module for finding location?

查看:140
本文介绍了找到位置的最佳node.js模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了几个 node.js模块,用于使用ip地址查找有关客户端位置和网络的信息。



要求:
$ b


  1. 城市,州,经纬度等。

  2. 网络 - 互联网服务提供商,互联网连接类型和互联网速度等。


  3. 数据准确性 - 最大可能性。


注意:寻找服务器端解决方案。



上述模块使用 maxmind数据。而且我还阅读了 maxmind数据准确性

我对选择上面的node.js模块有点困惑,我想知道是否有更好的node.js框架可用于查找符合我的要求的信息或任何其他语言插件,可以移植到node.js中。



任何想法都会很棒。

解决方案

使用基于IP的地理定位是可能的,但不是很准确。因此,我建议您考虑采用混合方法,比如尝试通过浏览器中的HTML5地理位置API获取用户位置,并在必要时将其退回到服务器侧。



我查看了可用于node.js的两个最常用的geoip / -location模块,它们都使用MaxMind提供的数据集。 AFAIK你必须手动保存这些数据库 - 2日期,这是一个明确的下跌。所以你可以考虑编写一个小的同步服务/脚本,每月更新一次数据库。 (有关MaxMinds免费解决方案的更多信息,请参阅此处)。



kuno / GeoIP 是一个GeoIP绑定,所以它的核心是使用libGeoIP C库,这是可以的,但可能不像纯JavaScript实现那样可移植 bluesmoon / node-geoip 优惠。两者都没问题,这取决于你更喜欢哪个图书馆。在性能方面你必须做一些benchmakrs(如果这个话题对你来说很重要)......这个问题没有普遍的答案,哪种类型的模块(C-binding / native)会更快。



如果你愿意花几块钱,你也可以看看 MaxMinds Web服务,这是一个简单的REST API,并且是最精确的方法。该文档相当不错 - 所以开始使用不会有问题。


I had found couple of node.js modules for finding the information about client location and network using ip address.

Requirements:

  1. Location - country, city, state, latitude, longitude etc.

  2. Network - Internet service Provider, Internet connection type and internet speed etc.

  3. Data Accuracy - maximum possibility.

Note: Looking for server side solution.

The above mentioned modules uses maxmind data. And i had read about the maxmind data accuracy as well.

I am little confused to choose the above node.js modules and i like to know is there any better node.js frameworks available for finding information which met my requirement or any other language plugins which can be portable to node.js.

Any idea will be greatful.

解决方案

Using IP-based geolocation is possible, but not very accurate. So I suggest you to think about going with a hybrid approach, like trying to get the users location via the HTML5 geolocation API inside the browser and fallback to the serverside if necessary.

I took a look at the two most used geoip/-location modules available for node.js and they both use the datasets provided by MaxMind. AFAIK you have to keep these databases up-2-date manually, which is a clear downer. So you may consider writing a little sync service / script, which updates the database once per month. (More information on MaxMinds free solution can be found here).

kuno/GeoIP is a GeoIP binding, so at it's core it's using the libGeoIP C library, which is okay, but maybe not as portable as the pure JavaScript implementation bluesmoon/node-geoip offers. Both are okay and it's up to you which library you like more. In terms of performance you have to do some benchmakrs (if this topic matters to you) … There is no general answer to the question, which type of module (C-binding/native) will be faster.

If you're willing to spend a few bucks you could also look into MaxMinds Web Service, which is a simple REST API and will be the most precise way to go. The documentation is quite good – so getting started with that won't be a problem.

这篇关于找到位置的最佳node.js模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆