beny23 / static-distance

https://beny23.github.io/static-distance/
Apache License 2.0
5 stars 2 forks source link

To generate outcodes:

awk -F, -f split_outcodes.awk ukpostcodes.csv

To select 200k postcodes at random

shuf -n 200000 ukpostcodes.csv > target/pubs.csv

To create a list of random pub names

paste -d "," <(paste -d " " <(shuf -r animal_names.txt) <(yes "and") <(shuf -r animal_names.txt) | head -200000) target/pubs.csv > target/named_pubs.csv

Explanation:

$ paste -d " " <(shuf -r animal_names.txt) <(yes "and") <(shuf -r animal_names.txt) | head -10
Flameback and Asiatic leopard
Guillemot and Magpie
Zebra and White ibis
Wallaby and Rabbit
Polecat and Mole
Towhee and Petrel
Wader and Quetzal
Kākāriki and Condor
Piping shrike and Recurvebill
Badger and Zebra

Finding the minimum lat/lon:

$ gunzip -dc ukpostcodes.csv.gz | grep -v 99.9999990 | cut -f3 -d, | awk -F, 'BEGIN { max = -999; min = +999; } /[0-9.-]+/ { if ($1 > max) max = $1; if ($1 < min) min = $1; } END { print min, max; }'
49.181941000000000 60.800793046799900
$ gunzip -dc ukpostcodes.csv.gz | grep -v 99.9999990 | cut -f4 -d, | awk -F, 'BEGIN { max = -999; min = +999; } /[0-9.-]+/ { if ($1 > max) max = $1; if ($1 < min) min = $1; } END { print min, max; }'
-8.163139000000000 1.760443184261870

Village names pulled from http://download.geonames.org/export/dump/