Skip to content
Norbert Renner edited this page Jul 11, 2017 · 1 revision
  1. openstreetmap.org changeset download + timing
    http://www.openstreetmap.org/api/0.6/changeset/#id/download -> cs-#id.osc
    LC_ALL=C curl -s -o "cs-#1.osc" -w '| %{filename_effective} | %{size_download} bytes | %{time_starttransfer} s | %{time_total} s |\n' "http://www.openstreetmap.org/api/0.6/changeset/{45229331,45018920,45031863,45656403,46858895,44989548,46988696,46552513,45488240,45489434,45064759,45639229,45579952}/download"
    
  2. create adiff id-filter query (.ql) from Changeset download (.osc)
    cs-#id.osc -> cs-#id.ql
    Uses first (minus one second) and last edit timestamps instead of changeset meta start/end timestamps.
    for CHANGESET in 45229331 45018920 45031863 45656403 46858895 44989548 46988696 46552513 45488240 45489434 45064759 45639229 45579952; do \
    osmium cat --no-progress -f opl cs-$CHANGESET.osc | \
    sed -e 's/^n/node /g' -e 's/^w/way /g' -e 's/^r/rel /g' | \
    sed '/^rel /d' | \
    TZ=UTC awk -F" " '{t=substr($6,2)} NR==1{gsub(/[-T:Z]/, " ", t); from=strftime("%Y-%m-%dT%H:%M:%SZ", mktime(t)-1)} {to=t} {a[$1]=a[$1]","$2} END{print "[adiff:\"" from "\",\"" to "\"];\n("; for(i in a) print i "(id:" substr(a[i],2) ");"; print ");\nout meta geom;"}' \
    > cs-$CHANGESET.ql; done
    
  3. run adiff query + timing
    cs-#id.ql -> cs-#id.adiff.xml
    for CHANGESET in 45229331 45018920 45031863 45656403 46858895 44989548 46988696 46552513 45488240 45489434 45064759 45639229 45579952; do \
    LC_ALL=C curl -s --data-binary "@cs-$CHANGESET.ql" -o "cs-$CHANGESET.adiff.xml" "http://overpass-api.de/api/interpreter" \
    -w '| %{filename_effective} | %{size_download} bytes | %{time_starttransfer} s | %{time_total} s |\n'; \
    sleep 180s; \
    done