initial import
This commit is contained in:
parent
7d4c841702
commit
2d06a3e71a
662 changed files with 3950 additions and 0 deletions
32
wmc.pl
Normal file
32
wmc.pl
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use LWP::Simple;
|
||||
|
||||
my $tolerance = '0.005';
|
||||
|
||||
my $wmc = 'http://mapit.mysociety.org/areas/WMC';
|
||||
|
||||
my $json = JSON->new->allow_nonref;
|
||||
|
||||
my $data = get($wmc);
|
||||
my $all = $json->decode($data);
|
||||
|
||||
foreach my $area ( sort { $a <=> $b } keys %$all ) {
|
||||
my $name = $$all{$area}->{name};
|
||||
|
||||
my $geojsonurl = "http://mapit.mysociety.org/area/$area.geojson?simplify_tolerance=$tolerance";
|
||||
my $file = "data/$area.geojson";
|
||||
|
||||
if ((stat($file))[7] == 0) {
|
||||
print "$area,$name\n";
|
||||
my $poly = get($geojsonurl);
|
||||
open F, ">$file";
|
||||
print F $poly;
|
||||
close F;
|
||||
}
|
||||
|
||||
sleep 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue