Extracting public transport layer from .osm

Hey all,

For my research i would need all the information related to public transport for Hamburg. this includes metro lines, metro stations, bus lines, bus stops, light and heavy rail and the stations.
I have tried to extract them using osm2shp and postgres, however i can only get the lines out of it and they are in some areas false. I assume that osm2shap does not recognize the corresponding tags. It only gives me the bus stations but not bus lines or metro stations.
Has anyone tried to retrieve this information? I know the information is in the .osm files as proved by www.öpnvkarte.de i just need a way to get the raw data :slight_smile:


At first you should download osm-Data from Hamburg. For example from Geofabrik: http://download.geofabrik.de/osm/europe/germany/
Then you can filter the OSM-data by tags, for example with Osmosis. The only difficulty is the huge amount of tags which are used.
In Osmosis you have to filter ways and nodes seperate.

Another possibility would be to download all relations dealing with public transport in Hamburg. Most of them should be listed here: http://wiki.openstreetmap.org/wiki/Hamburg/Transportation
But that won’t include nodes which are not used in any relation…

Maybe you’ve got the same problem like me. I’m trying to import data with power_souce tags into a postgres/postgis database, but within the Geofabrik shapefiles this kind of information is not included, so filtering is no solution. Does anybody know if there’s a tool to extract data with a special tag from OSM Server?! I found this site http://www.faveve.uni-stuttgart.de/~troll/OSM/ but the tags in the .csv download are mixed up, so an import to postgres is impossible…


Geofabrik extracts in .osm format contain all the tags. You can import .osm files into PosGIS with osm2pgsql utility. It imports only subset of tags but user can configure which tags are imported. Just add the power_souce on the tag list.

What is better? Use Osmosis or osm2pgsql?