来自 IP 地址的经度和纬度值 [英] Longitude and latitude value from IP address
问题描述
是否可以从asp.net中的IP地址获取经度和纬度值?如果可能的话,请告诉我如何获得这个.
Is it possible to get the longitude and latitude value from IP address in asp.net? If it is possible, please let me know how can I get this.
推荐答案
MaxMind Geolite city免费.如果它不够好,您显然可以升级到更准确的付费版本.我无法评价付费版本的质量,因为我从未使用过它.
MaxMind Geolite city is free. If it is not good enough, you can apparently upgrade to a more accurate paid-version. I can't speak for the quality of the paid version, as I have never used it.
如果您喜欢您的 SQL,请下载 CSV 版本.将其加载到您选择的数据库中,然后查询.
If you like your SQL, download the CSV version. Load it into your database of choice, and query away.
更快、更节省空间的选择是下载文件二进制blob版本同一个数据库,然后使用C#类查询.
The faster and space-efficient option is to download the file binary blob version of the same database, and then use the C# class to query it.
另外,我发现 ipinfodb.com 很有用.查询是通过简单的 HTTP GET.例如,要对 stackoverflow.com 进行地理定位,请尝试:
Alternatively, I have found ipinfodb.com to be useful. Query is by simple HTTP GET. For example, to geolocate stackoverflow.com try:
http://ipinfodb.com/ip_query.php?timezone=false&ip=69.59.196.211
这将返回一个包含纬度和经度的 XML 文件,如下所示:
This will return an XML file containing latitude and longitude, that looks like:
<Response>
<Ip>69.59.196.211</Ip>
<Status>OK</Status>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>41</RegionCode>
<RegionName>Oregon</RegionName>
<City>Corvallis</City>
<ZipPostalCode>97333</ZipPostalCode>
<Latitude>44.4698</Latitude>
<Longitude>-123.343</Longitude>
</Response>
http://forum.ipinfodb.com/上提供了一些 VB.NET 示例代码viewtopic.php?f=7&t=269
这篇关于来自 IP 地址的经度和纬度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!