Skip to main content
added 5 characters in body
Source Link
Carsten
  • 3.3k
  • 1
  • 13
  • 9

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();
    // void 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();
}

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();
    // void 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();
}

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();
}
added 65 characters in body
Source Link
Carsten
  • 3.3k
  • 1
  • 13
  • 9

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
    // void this.handler.onNode(long id, double lat, double lon);
    // void this.handler.onNodeTag(String key, String value);
    // void this.handler.onNodeComplete();
    // void this.handler.closeNodeProcessing();

    // 2) Then all Ways
    // void this.handler.onWay(long id);
    // void this.handler.onWayNdRef(long ndRefId);
    // void this.handler.onWayTag(String key, String value);
    // void this.handler.onWayComplete();
    // void closeWayProcessing();

    // 3) Finally all Relations
    // void this.handler.onRelation(long id);
    // void this.handler.onRelationMember(String type, long ref, String role);
    // void this.handler.onRelationTag(String key, String value);
    // void this.handler.onRelationComplete();
    // void this.handler.closeRelationProcessing();
}

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
    // void onNode(long id, double lat, double lon);
    // void onNodeTag(String key, String value);
    // void onNodeComplete();
    // void closeNodeProcessing();

    // 2) Then all Ways
    // void onWay(long id);
    // void onWayNdRef(long ndRefId);
    // void onWayTag(String key, String value);
    // void onWayComplete();
    // void closeWayProcessing();

    // 3) Finally all Relations
    // void onRelation(long id);
    // void onRelationMember(String type, long ref, String role);
    // void onRelationTag(String key, String value);
    // void onRelationComplete();
    // void closeRelationProcessing();
}

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();
    // void 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();
}
Source Link
Carsten
  • 3.3k
  • 1
  • 13
  • 9

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
    // void onNode(long id, double lat, double lon);
    // void onNodeTag(String key, String value);
    // void onNodeComplete();
    // void closeNodeProcessing();

    // 2) Then all Ways
    // void onWay(long id);
    // void onWayNdRef(long ndRefId);
    // void onWayTag(String key, String value);
    // void onWayComplete();
    // void closeWayProcessing();

    // 3) Finally all Relations
    // void onRelation(long id);
    // void onRelationMember(String type, long ref, String role);
    // void onRelationTag(String key, String value);
    // void onRelationComplete();
    // void closeRelationProcessing();
}