Tenendo questo a mente, l’unico modo che mi viene in mente per contare le modifiche che dici tu è contare a quanti elementi è stato aggiunto check_date o survey:date, nell’ipotesi che prima non ce l’avessero. Non è un calcolo perfetto ma ci da un’indicazione.
Codice e risultati
Codice per filtrare i dump e contare gli elementi, lo stesso usato per ottenere i dati del grafico sopra ma con aggiunto craft=* ai tag filtrati e aggiunto il conteggio degli elementi con check_date:
CSV_FILE="count.csv"
previous_total=0
previous_total_addr=0
previous_total_check_date=0
echo 'File,Total,Increase,Total with address,Increase with address,Total with check date,Increase with check date' > $CSV_FILE
for file in italy-*.pbf ; do
shops_file="shops_$file"
addr_file="addr_$file"
check_date_file="check_date_$file"
if [ ! -f "$shops_file" ]; then
echo "Filtering $file to $shops_file"
osmium tags-filter --omit-referenced -o "$shops_file" "$file" \
shop \
craft \
amenity=restaurant \
amenity=fast_food \
amenity=restaurant \
amenity=cafe \
amenity=fuel \
amenity=pharmacy \
amenity=bank \
amenity=bar \
amenity=pub \
amenity=dentist \
tourism=hotel \
tourism=guest_house \
leisure=fitness_centre
fi
if [ ! -f "$addr_file" ]; then
echo "Filtering $shops_file to $addr_file"
osmium tags-filter --omit-referenced -o "$addr_file" "$shops_file" \
addr:housenumber \
contact:housenumber
fi
if [ ! -f "$check_date_file" ]; then
echo "Filtering $shops_file to $check_date_file"
osmium tags-filter --omit-referenced -o "$check_date_file" "$shops_file" \
check_date \
survey:date
fi
echo "Counting $file"
nodes=`osmium fileinfo -e -g "data.count.nodes" "$shops_file"`
ways=`osmium fileinfo -e -g "data.count.ways" "$shops_file"`
total=$((nodes + ways))
diff=$((total - previous_total))
nodes_addr=`osmium fileinfo -e -g "data.count.nodes" "$addr_file"`
ways_addr=`osmium fileinfo -e -g "data.count.ways" "$addr_file"`
total_addr=$((nodes_addr + ways_addr))
#percentage_addr=$((100 * total_addr / total))
diff_addr=$((total_addr - previous_total_addr))
nodes_check_date=`osmium fileinfo -e -g "data.count.nodes" "$check_date_file"`
ways_check_date=`osmium fileinfo -e -g "data.count.ways" "$check_date_file"`
total_check_date=$((nodes_check_date + ways_check_date))
#percentage_check_date=$((100 * total_check_date / total))
diff_check_date=$((total_check_date - previous_total_check_date))
echo "$file,$total,$diff,$total_addr,$diff_addr,$total_check_date,$diff_check_date" >> $CSV_FILE
previous_total=$total
previous_total_addr=$total_addr
previous_total_check_date=$total_check_date
done
Risultato ad oggi in formato CSV:
File,Total,Increase,Total with address,Increase with address,Total with check date,Increase with check date
italy-250101.osm.pbf,465387,465387,164658,164658,29968,29968
italy-251031.osm.pbf,494061,28674,181296,16638,46688,16720
italy-251101.osm.pbf,494254,193,181374,78,46771,83
italy-251105.osm.pbf,495081,827,181869,495,47370,599
italy-251106.osm.pbf,495241,160,181995,126,47559,189
italy-251107.osm.pbf,495364,123,182029,34,47587,28
italy-251108.osm.pbf,495578,214,182110,81,47638,51
italy-251109.osm.pbf,495806,228,182243,133,47776,138
italy-251110.osm.pbf,495941,135,182430,187,47968,192
italy-251111.osm.pbf,496110,169,182485,55,48050,82
italy-251112.osm.pbf,496219,109,182537,52,48101,51