--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use JSON::XS;
+
+sub main {
+ my $csvfilename = shift // die "Must give csv filename!";
+
+ $csvfilename =~ s/.csv$//;
+
+ my $stat = {};
+
+ while (<>) {
+ /^(.*?),(.*?),(.*?),(.*?)$/ or die "Invalid csv line! [$_]";
+ my $zip = $1;
+ my $city = $2;
+ my $street = $3;
+ my $housenumber = $4;
+
+ next if !$zip;
+ next if !$city;
+
+ $stat->{cities}->{$city}->{$zip} = 1;
+ $stat->{zips}->{$zip}->{$city} = 1;
+ }
+
+ foreach my $city ( keys %{$stat->{cities}} ) {
+ $stat->{cities}->{$city} = [keys %{$stat->{cities}->{$city}}];
+ }
+
+ foreach my $zip ( keys %{$stat->{zips}} ) {
+ $stat->{zips}->{$zip} = [keys %{$stat->{zips}->{$zip}}];
+ }
+
+ my $ff;
+
+ open($ff, ">$csvfilename-cities-with-zips.json");
+ print $ff JSON::XS->new->canonical()->pretty()->encode($stat->{cities});
+ close($ff);
+
+ open($ff, ">$csvfilename-zips-with-cities.json");
+ print $ff JSON::XS->new->canonical()->pretty()->encode($stat->{zips});
+ close($ff);
+
+ return 0;
+}
+
+exit main(@ARGV);
echo -n "Osmconvert finished "
date
-git add hungary-latest-filtered.csv
+./csv2json.pl hungary-latest-filtered.csv
+
+echo -n "Generating json files finished "
+date
+
+git add hungary-latest-filtered.csv hungary-latest-filtered-*
GIT_AUTHOR_EMAIL='example@example.com' GIT_COMMITTER_EMAIL='example@example.com' git commit -m 'hungary-latest-filtered.csv daily update'
git push