Skip to content

Instantly share code, notes, and snippets.

@ajashton
Last active December 10, 2015 12:58
Show Gist options
  • Save ajashton/4437680 to your computer and use it in GitHub Desktop.
Save ajashton/4437680 to your computer and use it in GitHub Desktop.
// eg:
// osmjs -l sparsetable -2 -m -j osmjs_callbacsk_test.js <osm_file>
var called_node, called_way, called_relation, called_multipolygon;
Osmium.Callbacks.init = function() { print('✔ init'); }
Osmium.Callbacks.before_relations = function() { print('✔ before_relations'); }
Osmium.Callbacks.relation = function() {
if (!called_relation) {
print('✔ relation');
called_relation = true;
}
}
Osmium.Callbacks.after_relations = function() { print('✔ after_relations'); }
Osmium.Callbacks.before_nodes = function() { print('✔ before_nodes'); }
Osmium.Callbacks.node = function() {
if (!called_node) {
print('✔ node');
called_node = true;
}
}
Osmium.Callbacks.after_nodes = function() { print('✔ after_nodes'); }
Osmium.Callbacks.before_ways = function() { print('✔ before_ways'); }
Osmium.Callbacks.way = function() {
if (!called_way) {
print('✔ way');
called_way = true;
}
}
Osmium.Callbacks.multipolygon = function() {
if (!called_multipolygon) {
print('✔ multipolygon');
called_multipolygon = true;
}
}
Osmium.Callbacks.after_ways = function() { print('✔ after_ways'); }
Osmium.Callbacks.end = function() { print('✔ end'); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment