Why the detour via pbf? osm2po allows you to write your own Reader and to inject it into the processing chain. All you need is a Java-Class which implements OsmParser
.
@Override
public void open(InputStream inputStream,
OsmParserHandler osmParserHandler, Config config) {
this.handler = osmParserHandler;
this.log = config.getLog();
// inputStream is not needed, open your DB here instead.
// db-params can be set via config
}
@Override
public void close() {
// close your db here.
}
@Override
public void parse() {
// Read your table here and call back
// 1) All Nodes first
this.handler.onNode(long id, double lat, double lon);
this.handler.onNodeTag(String key, String value);
this.handler.onNodeComplete();
this.handler.closeNodeProcessing();
// 2) Then all Ways
this.handler.onWay(long id);
this.handler.onWayNdRef(long ndRefId);
this.handler.onWayTag(String key, String value);
this.handler.onWayComplete();
this.handler.closeWayProcessing();
// 3) Finally all Relations
this.handler.onRelation(long id);
this.handler.onRelationMember(String type, long ref, String role);
this.handler.onRelationTag(String key, String value);
this.handler.onRelationComplete();
this.handler.closeRelationProcessing();
}