Perl GeoNames Client

Perl GeoNames Client 是 GeoNames 的 Perl 语言客户端开发包。

示例代码:

  use Geo::GeoNames;
  use Data::Dumper;
  my $geo = new Geo::GeoNames();

  # make a query based on placename
  my $result = $geo->search(q => \'Fredrikstad\', maxRows => 2);

  # print the first result
  print " Name: " . $result->[0]->{name};
  print " Longitude: " . $result->[0]->{lng};
  print " Lattitude: " . $result->[0]->{lat};

  # Dump the data structure into readable form
  # This also will show the attributes to each found location
  Data::Dumper->Dump()

  # Make a query based on postcode
  $result = $geo->postalcode_search(postalcode => "1630", maxRows => 3, style => "FULL"); 

© 版权声明
THE END
喜欢就支持一下吧
点赞542 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容