mff-uk/DPUs — pull request #66 by Mingan (2014-04-29 08:26:03+00:00)
Title: Geocoding

I've modified Google Geocoder and Nominatim Geocoder DPUs. I added a checkbox style option to add schema:url with direct link to respective map services for debugging purposes and extended SPARQL query to extract country of the address from schema:addressCountry or schema:addressCountry/schema:name.

As for Google specific changes, handling of zero response case is handled correctly and is logged.

Changes for Nominatim are larger. I refactored the code, extracted class Address for generating different representations (structured/unstructured query, cache filename, human-readable version), slightly enhanced option for stripping numbers from schema:addressLocality to include Roman numerals as well. Based on tests I added automatic fallback option for cases when geocoding fails and the schema:streetAddress consist either only of digits (17, Stárkov, CZ) or contains value of schema:addressLocality (Stárkov 17, Stárkov, CZ). Second request is issued with schema:streetAddress replaced by schema:addressLocality (Stárkov, Stárkov, CZ). This happens often for small cities/villages where streets don't have names and Nominatim gets confused. Querying with the fallback format yields reasonable results in most cases.