Skip to content

Instantly share code, notes, and snippets.

@nickpeihl
Created March 6, 2021 00:11
Show Gist options
  • Save nickpeihl/691642c237ecd9456431fb66aa6435dc to your computer and use it in GitHub Desktop.
Save nickpeihl/691642c237ecd9456431fb66aa6435dc to your computer and use it in GitHub Desktop.
Grok expression for OpenStreetMap OPL format
OSMID [n|r|w][0-9]+
NODES (%{OSMID},?)+
MEMBERS (%{OSMID}@(\S+)?,?)+
%{OSMID:osmid}%{SPACE}v%{NUMBER:version}%{SPACE}d(?<deleted>[D|V])%{SPACE}c%{INT:changeset_id}(%{SPACE}t%{TIMESTAMP_ISO8601:@timestamp})?%{SPACE}i%{USERNAME:userid}%{SPACE}u(%{USERNAME:username})?%{SPACE}T(?<tags>[\S+=\S+]+)?(%{SPACE}x%{NUMBER:longitude})?(%{SPACE}y%{NUMBER:latitude})?(%{SPACE}N%{NODES:nodes})?(%{SPACE}M%{MEMBERS:members})?
osmium cat -o washington-latest.opl washington-latest.osm.pbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment