经度和纬度值从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上城是免费。如果它不够好,你可以明显地升级到更准确的付费版本。我不能为付费版本的质量说话,因为我从来没有使用过。
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,下载<一个href=\"http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity_20100401.zip\">CSV版本。加载到您选择的数据库,并查询了。
If you like your SQL, download the CSV version. Load it into your database of choice, and query away.
更快,空间效率的选择是下载文件的二进制数据版本同一个数据库中,然后使用的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>
一些VB.NET示例code可在<一href=\"http://forum.ipinfodb.com/viewtopic.php?f=7&t=269\">http://forum.ipinfodb.com/viewtopic.php?f=7&t=269
这篇关于经度和纬度值从IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!