![](/img/trans.png)
[英]ppm install failed: The PPD does not provide code to install for this platform
[英]Does GeoLite2 provide coordinates?
我很困惑,免費的GeoLite2數據庫是否再提供坐標(緯度,經度)?
我一直在使用GeoLite,並且能夠使用Geo::IP
和->latitude
調用來獲取坐標。 我已經瀏覽了文檔並GeoIP2::Database::Reader
但是沒有對坐標的引用。 似乎僅當通過Web API查詢Maxmind時才可用。
注意:經過仔細考慮,考慮到客戶的反饋意見,我們決定不從GeoLite2數據庫中刪除緯度和經度坐標。
Maxmind似乎暗示它應該仍然存在嗎? 但是,Perl如何訪問它呢?
GeoLite2提供緯度和經度。 使用Perl GeoIP2
API,您應該能夠進行以下訪問:
my $reader = GeoIP2::Database::Reader->new(
file => '/path/to/database',
);
my $city = $reader->city( ip => '24.24.24.24' );
say $city->location->latitude;
say $city->location->longitude;
請注意,這些坐標是粗略估計。 請參閱$city->location->accuracy_radius
以獲取以公里為單位的坐標的估計精度(67%置信度)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.