I am conducting a project about rail accessibility/capacity, working with railways/stations downloaded in R with Overpass.

Manually I computed the number of trains for each lines and I would like to assign this values to specific segment of the SpatialLinesDataFrame.

For Instance, Zagreb-Osijek 20 trains, I want the line passing through this two stations to have 20 as value.

Obviously I don't want to create a new line, but to use the existing railway.

The problem is that the lines representing the railways have different starting and ending points from the station nodes.

Any suggestions to perform this process?

I thought that merging all the lines in one feature could help.

railways_merged <- gLineMerge(railways)

In this way I have only one feature, and I guess that I need to re-split them according to points (stations).

  • 1
    Do you have a "from" and "to" field in your polyline layer? When you computed your number of trains per line manually did you use a table that can reference the stations using a station ID field, so your values can be joined to the attribute table of the polylines? – geoJshaun Jan 3 '17 at 20:02
  • I haven't a from and to field in the layer, just several technical fields (like electrification, speed limit, etc), usually n/a, but I have the stations ID in my file built manually. – Gabriele Filomena Jan 3 '17 at 20:24
  • Couldn't you just add a field and then join your polyline attribute table to the one you created manually using station ID and then update the new field with the train volumes? – geoJshaun Jan 3 '17 at 20:36
  • Yes, I could. The issue is that usually lines are shorter that the distance between two stations. They could be 1 km, or even just a few meters. – Gabriele Filomena Jan 3 '17 at 20:41
  • The spatial difference should interfere with a table join based on attributes. – geoJshaun Jan 3 '17 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.