Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a software component were using we need to provide 2 input files. One with a list of nodes (nodeId, lat, lon) and one with ways (fromNodeId, toNodeId, oneway, maxSpeed, lenght).

To create these 2 files I created a custom postprocessor class, you can find the code here:

To get the Nodes I read the "tn_raw.2po" file, for the ways the "sw_all.2po" file. This works great, but now my node output files contains all osm nodes. What I would like, is that the file only contains the nodes used in the ways file.

Is it possible to only output the used nodes in a file?


share|improve this question
up vote 0 down vote accepted

Use the sv_all.2po and sw_all.2po instead.

The corresponding classes are:

  • Vertex
  • SegmentedWay

Here is a sample of how to loop over the Vertices:

File inFile = new File("sv_all.2po");
InStream is = new InStreamDisk(inFile);
byte type = is.readByte(); // We know what's in there

Vertex vertex = new Vertex();
while (!is.isEof()) {


Every *.2po-file follows the same loop pattern. Here is the original code for the cmd=d option.

public class Debug {

    public static void dump2poFile(Config config) throws Exception {

        InStream inStream = new InStreamDisk(config.getFiles().get(0));
        byte varType = inStream.readByte();
        Var var = VarTypeDesk.create(varType);
        int i = 0;
        while (!inStream.isEof()) {
            System.out.println("[" + (i++) + "] " +  var.readFromStream(inStream));

share|improve this answer
Thx! Works great if I use the vertex file – TimVG Feb 27 '13 at 20:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.