diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-11-07 15:29:25 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2014-11-19 14:19:06 +0000 |
commit | 55dbf51f98b523f41c83959875295853e1457dcf (patch) | |
tree | bd87d80aea045e3ff0ddea7414cb13ceec19b8c9 /bin/fiksgatami/showroadinfo | |
parent | a8f45b97bd0b91f714ff77fa9d3fbdf0e6981a15 (diff) |
[FiksGataMi] Add two testing scripts for roads.
Diffstat (limited to 'bin/fiksgatami/showroadinfo')
-rwxr-xr-x | bin/fiksgatami/showroadinfo | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/fiksgatami/showroadinfo b/bin/fiksgatami/showroadinfo new file mode 100755 index 000000000..658fca01c --- /dev/null +++ b/bin/fiksgatami/showroadinfo @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use FixMyStreet::App; +use FixMyStreet::Geocode::OSM; +use Data::Dumper; + +FixMyStreet::App->model('DB::Problem')->send_reports(); + +my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('fiksgatami')->new(); + +sub isRoadOperator { + my ($latitude, $longitude, $operatorname) = @_; + my $osmtags = FixMyStreet::Geocode::OSM::get_nearest_road_tags( + $cobrand, $latitude, $longitude); + print STDERR Dumper($osmtags); + my $operator = $osmtags->{operator} || $osmtags->{operatorguess}; + if ($operator) { + my ($name, $ref) = ('',''); + $name = " named $osmtags->{name}" if exists $osmtags->{name}; + $ref = " ($osmtags->{ref})" if exists $osmtags->{ref}; + print STDERR "Claiming operator $operator for way$name$ref\n"; + return ($operator eq $operatorname); + } + return undef; +} + +my $latitude = $ARGV[0] || 63.37638; +my $longitude = $ARGV[1] || 10.37595; + +unless (isRoadOperator($latitude, $longitude, "Statens vegvesen")) { + print STDERR "Operator is not Statens vegvesen\n"; +} |