aboutsummaryrefslogtreecommitdiffstats
path: root/bin/zurich/geocode
blob: 9482b27e6b2ef4634a08c677cdddcb7791de511c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl

=head1 NAME

zurich/geocode - commandline tool to test the Zurich geocoder

=head1 SYNOPSIS

    # Firstly:
    ## copy the GEOCODER config from a current Zurich conf to your conf/general.yml
    $  eval `perl setenv.pl`
    
    $ bin/zurich/geocode Magnus

    # ... output from geocoder

This can be used to test the results of, e.g.

    https://www.zueriwieneu.ch/ajax/geocode?term=Magnus

but without the caching which FixMyStreet applies, and passing on any 500
errors from the server.

=cut

use strict;
use warnings;
require 5.8.0;


use Data::Dumper;
use feature 'say';

use FixMyStreet;
use FixMyStreet::App;
use FixMyStreet::Geocode::Zurich;

# TODO use FixMyStreet::override_config to get data from conf/general.yml.zurich if available
my $geocoder = FixMyStreet->config('GEOCODER')
    or die "No GEOCODER config -- please copy appropriate Zurich conf to conf/general.yml";

my $c = FixMyStreet::App->new();
my $s = join ' ', @ARGV;

say Dumper( FixMyStreet::Geocode::Zurich::string( $s, $c ) );