大佬教程收集整理的这篇文章主要介绍了perl – 地理编码……我做错了吗?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
use Geo::Coder::Google; use Geo::Coder::Bing; use Geo::Coder::Many; use Geo::Coder::Many::Util qw( country_filter ); # Create the Geo::Coder::Many object,telling it to use a 'weighted random' # scheduling method my $options = { scheduler_type => 'WRR',}; my $geocoder_many = Geo::Coder::Many->new( $options ); # Create and add a geocoder my $Locatorize = Geo::Coder::Google->new( apikey => 'yur Key' ); my $Locatorize_options = { geocoder => $Locatorize,daily_limit => 2500,#google has a 2,500 limit/day }; $geocoder_many->add_geocoder( $Locatorize_options ); my $result = $geocoder_many->geocode( { LOCATIOn => '1600 Amphitheatre Parkway Mountain View,CA 94043' } ); if (defined $result) { print "Longitude: ",$result->{longitudE},"\n"; print "Latitude: ",$result->{latitudE},"\n"; } else { print "Failed to geocode!\n"; }
这将返回(正确):
经度:-122.085099
纬度:37.422782
当我将提供者更改为Bing时,事情就出错了:
@H_751_2@my $WhereIzIt = Geo::Coder::Bing->new( key => 'Yur key' ); my $WhereIzIt_options = { geocoder => $WhereIzIt,daily_limit => 4000,}; $geocoder_many->add_geocoder( $WhereIzIt_options );返回:
经度:37.423176
纬度:-122.085962
Bing始终如一地向后退回结果?我如何在模块中更改此内容?
longitude => $raw_reply->{point}->{Coordinates}->[0],latitude => $raw_reply->{point}->{Coordinates}->[1],
并交换0和1:
longitude => $raw_reply->{point}->{Coordinates}->[1],latitude => $raw_reply->{point}->{Coordinates}->[0],
这是Geo-Coder-Many中的一个错误,而不是Geo :: Coder :: Bing.确保您向right author报告了错误和此修复程序.
以上是大佬教程为你收集整理的perl – 地理编码……我做错了吗?全部内容,希望文章能够帮你解决perl – 地理编码……我做错了吗?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。