Generating Bahn Layouts

This area is dedicated to our foreign guests of this forum. Contributions can be written in any language.
[Diese Kategorie ist den ausländischen Gästen dieses Forums gewidmet. Beiträge können in beliebiger Sprache verfasst werden.]
Chris
Beiträge: 175
Registriert: Donnerstag 24. Mai 2007, 03:26
Wohnort: Cardiff

Re: Generating Bahn Layouts

Beitrag von Chris »

For security reasons, recent distributions of Perl don't include the current directory in the include path.

You need to run it with the environment variable PERL_USE_UNSAFE_INC set.
Do27flyer
Beiträge: 2
Registriert: Montag 15. Juli 2019, 15:20
Wohnort: Baarn, die Niederlande

Re: Generating Bahn Layouts

Beitrag von Do27flyer »

Or, you can copy the file ops2jbss.pm, from your C:\ops2\ into C:\Strawberry\perl\site\lib
broodje
Beiträge: 20
Registriert: Montag 13. März 2006, 15:28
Wohnort: Leiden, The Netherlands

Re: Generating Bahn Layouts

Beitrag von broodje »

Thanks Chris, I did not understand the explanation in your link, but I got it working by putting al the PL en PM files in the Strawbery\perl\site\lib map :).

Currently the script is working on creating the UK (or part of it at least). It did run a test area successfully.
Chris
Beiträge: 175
Registriert: Donnerstag 24. Mai 2007, 03:26
Wohnort: Cardiff

Re: Generating Bahn Layouts

Beitrag von Chris »

Do27flyer hat geschrieben:Or, you can copy the file ops2jbss.pm, from your C:\ops2\ into C:\Strawberry\perl\site\lib
It's not normally advised, but you can do that, and if you're on Windows and not likely to use Perl for anything else it will at least get it working. I've got a project on the back-burner to overhaul this, but if it's anything like the rate of progress on my other projects you can probably expect an early broken alpha sometime by 2030 :P
broodje
Beiträge: 20
Registriert: Montag 13. März 2006, 15:28
Wohnort: Leiden, The Netherlands

Re: Generating Bahn Layouts

Beitrag von broodje »

No I won't use Perl for much else, if anything at all ;). But it did work!
The script ran for 5 hours, creating a 6.3 GB Sqlite database of a 19GB OSM map file, which then resulted in a 33.9MB BNA File. That file took 30(!) hours to process by Bahn 3.89, resulting in almost the whole of the UK (Metro, Rail and Highway) and a 14MB save file. I do feel both Bahn as the Perl script could use some parallelisation, Core 2 ran at top speed for hours and hours while the rest was doing nothing :).
Chris
Beiträge: 175
Registriert: Donnerstag 24. Mai 2007, 03:26
Wohnort: Cardiff

Re: Generating Bahn Layouts

Beitrag von Chris »

For information, if anyone didn't know, there's this handy thing called Overpass API which will let you extract just the features you want, and will produce much smaller files that will be easier both for the generator and BAHN to process. Not sure if I've still got the scripts I used, but I was able to produce only the features I was interested in, limited to a radius that would only have data where it would be visible if a vehicle were followed on 1:1 zoom.

(edit)
Ah, found it. The two funny lines mean "get the nodes (points) for all the ways (lines) the previous step spat out":

Code: Alles auswählen

[timeout:3600][maxsize:2147483647];
way[railway=rail]($top,$left,$bottom,$right);
(._;>;);
way(around:1500);
(._;>;);
out meta;
isidromapache
Beiträge: 1
Registriert: Sonntag 12. April 2020, 23:21

Re: Generating Bahn Layouts

Beitrag von isidromapache »

Hi there! First of all, forgive my Google English. I have installed ops2jbss but cannot use it. I have read the manual on the web several times but I do not understand it. I just want to make my city (Valladolid, Spain).
Thank you.
MLG
Beiträge: 67
Registriert: Freitag 19. August 2011, 13:15

Re: Generating Bahn Layouts

Beitrag von MLG »

isidromapache hat geschrieben:Hi there! First of all, forgive my Google English. I have installed ops2jbss but cannot use it. I have read the manual on the web several times but I do not understand it. I just want to make my city (Valladolid, Spain).
Thank you.
http://www.das-bahn-forum.de/bahnforum/ ... 8&start=15

Use https://www.deepl.com/translator for translation.
1993matias
Beiträge: 308
Registriert: Dienstag 20. Januar 2009, 18:53
Wohnort: Dänemark
Kontaktdaten:

Re: Generating Bahn Layouts

Beitrag von 1993matias »

Hi again, I'm amazed that the program is still available for download. Unfortunately the newest version (0.22) is corrupted according to winRAR. Version 0.20 unzips fine, but PERL refuses to run the script - too many errors. I know I've run this program before, but I do not remember how

Does anybody have new information about a configuration that works?

Code: Alles auswählen

syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 48, near "do S_init("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 52, near "do menu("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 58, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 116, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 144, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 189, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 194, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 200, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 206, near "do S_cls("
syntax error at C:\Users\Matias\Desktop\lib\ops2jbss.pl line 211, near "do S_cls("
C:\Users\Matias\Desktop\lib\ops2jbss.pl has too many errors.
Kind regards - Matias
Denmark 2018 in BAHN finished! Mostly, at least
1993matias
Beiträge: 308
Registriert: Dienstag 20. Januar 2009, 18:53
Wohnort: Dänemark
Kontaktdaten:

Re: Generating Bahn Layouts

Beitrag von 1993matias »

Okay, it seems like I got the program working and able to export a small test area. How to:

Download an old version of Perl: https://strawberryperl.com/releases.html
I used version 5.14.4.1 from 2013. It opens ops2jbss fine. You might need to uninstall other versions of Perl for the installer to work.

Use command CCA and then CDB to clear anything remaining from earlier attempts. Then use command C to confirm the data parameters before continuing.
Use command S to initiate the file structure needed (this seems to avoid the empty .bna file bug), after a moment or two terminate ops2jbss.
Start ops2jbss again and use command O to select the .osm file to import, for example "O testarea.osm", then use command G to generate a .bna file. This should make a .bna file with the specified filename. This can be imported to BAHN.

Now, to the next problem of mine: How do I split a big .osm file into smaller bits? It seems 3 gigabytes is way too big for the script to handle. Either make different .osm files containing exclusively roads, another with railways, and so on; or simply cut the files into smaller bits that could be stitched together after importing to BAHN. But how?
Maybe this is not the right forum to ask, but where can I find help then? I've tried looking at Osmosis myself, but I am not tech savvy, so it's all gibberish to me, unfortunately. The readme files there are no help at all.

EDIT: I have managed to make the whole process work from OpenStreetMap data to a finished BAHN-import. It is difficult to explain here, but should you need help please let me know. I can explain it to you or generate the necessary .bna files for you. Importing them to BAHN is the easiest step :)
Kind regards - Matias
Denmark 2018 in BAHN finished! Mostly, at least
1993matias
Beiträge: 308
Registriert: Dienstag 20. Januar 2009, 18:53
Wohnort: Dänemark
Kontaktdaten:

Re: Generating Bahn Layouts

Beitrag von 1993matias »

Sorry for hijacking this thread, but I gotta say... BAHN might be slow, but it is definitely stable! Guess the country:
Bild

So by accident I started importing a 250 MB .bna-file containing all railways and roads and forests and everything in Ireland. After 72 hours I stopped it and this was the result, a 37 MB nt3 savefile. Unfortunately it's too sluggish to work with, so I'll try again with fewer roads.
Hint: have your .bna-file on a USB-stick, so you can pull it out to stop the import. BAHN will give you an "unexpected end of file" error, and then you will be able to use the map as it was imported until that moment.
Kind regards - Matias
Denmark 2018 in BAHN finished! Mostly, at least
RMV05
Beiträge: 794
Registriert: Donnerstag 23. Februar 2006, 19:35
Wohnort: Königstein/Ts. (Frankfurt/Main)
Kontaktdaten:

Re: Generating Bahn Layouts

Beitrag von RMV05 »

1993matias hat geschrieben:Sorry for hijacking this thread, but I gotta say... BAHN might be slow, but it is definitely stable! Guess the country:
Bild

So by accident I started importing a 250 MB .bna-file containing all railways and roads and forests and everything in Ireland. After 72 hours I stopped it and this was the result, a 37 MB nt3 savefile. Unfortunately it's too sluggish to work with, so I'll try again with fewer roads.
Hint: have your .bna-file on a USB-stick, so you can pull it out to stop the import. BAHN will give you an "unexpected end of file" error, and then you will be able to use the map as it was imported until that moment.
This is great. Can you generate us a Version from Germany? It will be don´t work by me.

Thanks and best regards
1993matias
Beiträge: 308
Registriert: Dienstag 20. Januar 2009, 18:53
Wohnort: Dänemark
Kontaktdaten:

Re: Generating Bahn Layouts

Beitrag von 1993matias »

RMV05 hat geschrieben: This is great. Can you generate us a Version from Germany? It will be don´t work by me.

Thanks and best regards
Send me a screenshot of the map (from Google Maps, Open Street Map, Bing, etc.) and the .osm-file, then I can generate the .bna file for you. Importing into BAHN you will have to do yourself, I'm afraid - but that's the easiest part
Kind regards - Matias
Denmark 2018 in BAHN finished! Mostly, at least
Antworten