Author |
Message |
08/06/2006 10:43:10
|
Penfold
Joined: 08/06/2006 10:40:34
Messages: 2
Offline
|
Are there any restrictions on use of the webservices (specifically geocoding postcodes?) in terms of commercial/non-commercial use, bandwidth or requests/day? I tried a hunt round the site but couldn't find a note on this.
|
|
|
08/06/2006 17:47:51
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4412
Offline
|
Hi
There are no restrictions, however, the services are licensed with an 'attribution license'. It means it would be nice of you to give credit to geonames, if you are using the data or the web services. It does not matter whether you use the data or web service commercially or not.
If you want to help us defray the cost for our servers you can make a donation via Paypal or you can contact us to be invoiced.
If you plan to make an awful lot of requests per day, we can also set up a dedicated server for you only.
Marc
|
|
|
|
08/06/2006 18:53:53
|
Anonymous
|
Terrific. Do you have a standard format or graphic for the credit/attribution?
|
|
|
08/06/2006 19:05:39
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4412
Offline
|
There is unfortunately no official geonames logo available yet. We don't have a designer among us and don't feel competent enough to create one.
Many users use a text like 'Powered by Geonames'.
Noiv from ExploreOurPla.net is using the following logo :
Marc
|
|
|
|
08/06/2006 19:38:04
|
Anonymous
|
Great
I'll pop that up tomorrow morning, as well as a little note here on what we're doing.
|
|
|
09/06/2006 18:21:43
|
Penfold
Joined: 08/06/2006 10:40:34
Messages: 2
Offline
|
Up - see http://www.perplexcity.com/help/stores/index.build
In a nutshell, we're providing a 'find your nearest retailer' service for players of the PerplexCity game. We have our own decent geocode tables for US and UK, stored in a MySQL table, but the rest get hived off to GeoNames, and we cache the result we get back in the table for later, so as to save bandwidth (GeoNames' and ours) and time (ours!) :)
... with a little piece of Perl that sorta looks like this:
Code:
use URI::Escape;
use XML::Simple;
use LWP::UserAgent;
use PXC::Geocode; # Class::DBI class referencing geocode table
sub geocode
{
my $country = shift;
my $postcode = shift;
# first try the DB
my $gc = PXC::Geocode->retrieve(postcode => $postcode, country_id => $country);
if (defined $gc)
{
return ($gc->latitude, $gc->longitude);
}
# try GeoNames
$postcode = uri_escape($postcode);
$country = uri_escape($country);
my $ua = LWP::UserAgent->new;
my $url = "http://ws.geonames.org/postalCodeSearch?maxRows=1&postalcode=$postcode&country=$country";
my $response = $ua->get($url);
my $xml = XML::Simple->new;
my $res = $xml->XMLin($response->content);
if (exists $res->{code}->{lat})
{
my $lat = $res->{code}->{lat};
my $lng = $res->{code}->{lng};
PXC::Geocode->create( {
latitude => $lat,
longitude => $lng,
postcode => $postcode,
country_id => $country
}
);
return ($lat, $lng);
}
}
[edited a bit to produce a standalone code fragment (barring the Class::DBI bit)]
|
|
|
|