Search notes:

Perl module Geo::Coder::OSM

Geo::Coder::OSM allows to geocode addresses with the OpenStreetMap Nominatim API.
#!/usr/bin/perl
use warnings;
use strict;

use Data::Dumper;

use Geo::Coder::OSM;

my $geocoder = Geo::Coder::OSM -> new;

my $details = $geocoder -> geocode(location=>'Zurlindenstr. 215');
 
print Dumper($details);
#
#$VAR1 = {
#          'place_id' => '73788333',
#          'type' => 'company',
#          'boundingbox' => [
#                             '47.3746064',
#                             '47.3747684',
#                             '8.5139472',
#                             '8.5141898'
#                           ],
#          'lat' => '47.37469045',
#          'address' => {
#                         'house_number' => '215',
#                         'postcode' => '8003',
#                         'city' => 'Zurich',
#                         'country' => 'Switzerland',
#                         'county' => "Bezirk Z\x{fc}rich",
#                         'suburb' => 'Wiedikon',
#                         'road' => 'Zurlindenstrasse',
#                         'address29' => 'Sertis engineering GmbH',
#                         'state' => 'Zurich',
#                         'country_code' => 'ch'
#                       },
#          'lon' => '8.51406796717677',
#          'licence' => "Data \x{a9} OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
#          'class' => 'office',
#          'display_name' => "Sertis engineering GmbH, 215, Zurlindenstrasse, Sihlfeld, Wiedikon, Zurich, Bezirk Z\x{fc}rich, Zurich, 8003, Switzerland",
#          'importance' => '0.101',
#          'osm_id' => '39523637',
#          'osm_type' => 'way'
#        };
Github repository PerlModules, path: /Geo/Coder/OSM/script.pl

See also

Perl modules

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758843692, '216.73.216.5', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/Geo/Coder/OSM/index(84): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78