Counting roads crossing a border


I am looking for a way to count automatically the number of roads crossing a border in Europe. Do anyone know how to do this, or would anyone have a trail of how to do this on Openstreetmap or others ?



Tell us first: what is exactly a road in your aim?

Because raw OSM XML data contains many ways, next to other elements like nodes and relations. see for details.

And then tell us how you determine* in general* whether a road (or way) is crossing a border.

I would suggest this is positive when a start node or end node of a way is also an element of a boundary way, or when one node of a way in the middle is also such an element of a boundary.

Country boundary ways in OSM should have tags like boundary=administrative and admin_level=2

Maybe you can do such tests via any SQL queries in PostGIS/Postgresql, or via … see its example pages in OSM wiki.