diff options
author | Struan Donald <struan@exo.org.uk> | 2011-11-18 14:32:25 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-11-18 14:32:25 +0000 |
commit | 9a83d679abbdb467ec1c363d086b35f09a4c7044 (patch) | |
tree | 30c8fece41b518080fd420d33c2aaf742ddd6ea0 /bin/generate_council_location | |
parent | d941a8c26e943c941f8e37ecbd9a9982dd41cb70 (diff) | |
parent | 375610803cfcad104049ff895c77c53e6767e1e7 (diff) |
Merge remote branch 'origin/master' into js-validation
Diffstat (limited to 'bin/generate_council_location')
-rw-r--r-- | bin/generate_council_location | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/generate_council_location b/bin/generate_council_location new file mode 100644 index 000000000..36bf14d04 --- /dev/null +++ b/bin/generate_council_location @@ -0,0 +1,26 @@ +use strict; +use JSON; +use LWP::Simple; + +my $id = shift; + +my $url = sprintf( 'http://mapit.mysociety.org/area/%s/geometry', $id); + +my $json = get( $url ); +my $geo = decode_json( $json ); + +my $max_lat = $geo->{max_lat}; +my $min_lat = $geo->{min_lat}; +my $max_lon = $geo->{max_lon}; +my $min_lon = $geo->{min_lon}; +my $c_lat = $geo->{centre_lat}; +my $c_lon = $geo->{centre_lon}; + +my $spn_lat = $max_lat - $min_lat; +my $spn_lon = $max_lon - $min_lon; + +print <<"EOT"; + centre => '$c_lat,$c_lon', + span => '$spn_lat,$spn_lon', + bounds => [ '$min_lat,$min_lon','$max_lat,$max_lon' ], +EOT |