i am using osm2po to import osm file, into postgres/gis.

after de commenting in osm2po config file:

#postp.2.class = de.cm.osm2po.plugins.PgVertexWriter

i get a nice vertices table, with turn restrictions.

i also get a ref_count column for each vertex id.

i am trying to understand what it stands for.

initially i thought its how many times this vertex exist in the table, but quickly i discovered its untrue.

i will appreciate any help/insights as to ref_count column and its meaning.

specifically, i am trying to understand, given a target vertex, how many options for turning i have. (how many vertex and which are accessible via this vertex)

example: if im on vertex id 111, -> can access vertex id 112 and 113

i thought ref_count might help with that. (just the number of possible vertex's will be useful for me, and yes i can count it easily myself, but im curious about ref_count)

thanks for your help!

1 Answer 1


ref_count (Reference Counter) is an internal information, rather meant for debugging purposes. Nevertheless, it should (in most cases) give you correct results. The only strange thing is, that you'll have to count +1:

\ A
  *------ C
   \ B

Here, the ref_count should be 2 (instead of 3) where


should return 0.

  • i see thanks for your help! and even more so your amazing tool! would u say that i can count that ref_count count is without fault? (when i count myself i get slightly different results even with +1, it is very possible that i still have some bugs in my code), much obliged.
    – yaron
    Jul 1, 2013 at 20:58
  • and also which cases do count in most cases? i.e when it will not be accurate, may be it accounts for the differences i see.
    – yaron
    Jul 1, 2013 at 21:05
  • im sorry, i meant which cases do not count in most cases. thanks.
    – yaron
    Jul 1, 2013 at 21:15
  • It's better to not rely on it. I've modified the chart above and enriched it with A,B and C denoting original OSM Ways. There are two options: A and B are different ways, then ref_count=2, but if they've been tagged as one single way, you'll receive a ref_count of 1.
    – Carsten
    Jul 3, 2013 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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