curl 'https://geocode.nigelhorne.com/cgi-bin/page.fcgi?page=query&q=Rock+Bottom,+Bethesda,+MD'
With VWF it was a minor change:
$rc = $geocoder->geocode(location => $q);]]>if(!defined($rc)) {
if(my $country = $self->{_lingua}->country()) {
$rc = $geocoder->geocode(location => "$q, $country");
}
return '{}' if(!defined($rc));
}
So I've added support for that. As a proof of concept, I only work on Restaurants, however the Whos On First data includes a (admittedly unsupported field) of sg:classifier which I should be able to use for a more wide support. What that means is that is if a business type is included in the name of the business, I can remove it and anything after that and add it to the database. In simple terms that allows "Foo Hairdressers and Barber's shop" to be indexed as "Foo". And because you don't always know the street name, it's indexed both with and without.
I'm sure there will be plenty of cases were the above scenario doesn't work - I'll monitor Apache logs - but as a start it works surprisingly well, as shown by
curl 'https://geocode.nigelhorne.com/cgi-bin/page.fcgi?page=query&q=Rock+Bottom,+Bethesda,+MD,+USA']]>
I've written a few Perl related Genealogy programs including gedcom (https://github.com/nigelhorne/gedcom) and ged2site (https://github.com/nigelhorne/ged2site). One of the things that these do is to check the validity of your family tree, and one of those tasks is to verify place-names. Of course places do change names and spelling becomes more consistent over the years, but the vast majority remain the same. Enough of a majority to computerise the verification. Unfortunately all of the on-line services have one problem or another - most either charge for large number of access, or throttle the number of look-ups. Even my modest tree, just over 2000 people, reaches those limits.
There are, however, a number of free databases that can be used, including MaxMind, GeoNames, OpenAddresses and WhosOnFirst. The objective of Geo::Coder::Free (https://github.com/nigelhorne/Geo-Coder-Free) is to create a database of those databases and to create a search engine either through a local copy of the database or through an on-line website. Both are in their early days, but I have examples which do surprisingly well.
The local copy of the database is built using the createdatabase.PL script which is bundled with G:C:F. That script creates a single SQLite file from downloaded copies of the databases listed above. Running 'make' will download GeoNames and Maxmind, but OpenAddresses and WhosOnFirst need to be downloaded manually if you decide to use them - they are treated as optional by G:C:.F.
There is a sample website at https://geocode.nigelhorne.com/. The source code for that site is included in the G:C:F distribution.
]]>