红联Linux门户
Linux帮助

Perl语言客户端开发包 Perl GeoNames Client

发布时间:2012-09-03 15:00:32来源:红联作者:empast
Perl GeoNames Client 是 GeoNames 的 Perl 语言客户端开发包。

示例代码:[code]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");[/code]主页:http://search.cpan.org/~perhenrik/Geo-GeoNames/lib/Geo/GeoNames.pm

下载:http://code.google.com/p/geo-geonames/downloads/list

来自:开源中国社区
文章评论

共有 0 条评论