MINETEST RAILWAY CONNECTIONS SEARCH ENGINE
Description
MineTest Railway Connections Search Engine is tool which allows to search train connections between the railway stations of interest to us. It using MapServer and MapServer MOD to download train lines (defined earlier by mapserver:train blocks) and saved train lines (with distances and travel time) and connections between cities (based on train lines) to database.
It uses Floyd–Warshall algorithm to fast find path between start station and end station (show only one path), and undirected graph to find all paths between stations (note: if some city doesn’t have connection with graph, it causes freezing website or show server error 503 – Service Unavailable, so Floyd–Warshall algorithm fix it).
Depends
- PHP
- MapServer
- MapServer module
- Server WWW with PHP support
Project website
Download
License
Other information
- https://thenounproject.com/ – some icons are downloaded from it
Installing & Configuration
- Create new database in your database system (PostgreSQL, MySQL, SQLite is using file) and assign permissions to this database.
- Open php.ini and check that extension selected database is enabled (uncomment line, remove ‘;’):
- if you choose MySQL:
- extension=pdo_mysql
- if you choose PostgreSQL:
- extension=pdo_pgsql
- if you choose SQLite:
- extension=pdo_sqlite
- if you choose MySQL:
- Save file and restart your web server.
- Download project to your web server documents root directory.
- Open minetest.php.
- On the beginning file you have few lines to configuration.
- MINETEST_ADVTRAINS_AVG_SPEED – average speed of trains in m/s… default is 20 m/s
- MINETEST_MAPSERVER – URL to MineTest mapserver
- DB_CONNECTION – string connection to database, see above for examples.
- DB_LOGIN – login to database (sqlite don’t use it – you can set to empty or null)
- DB_PASSWORD – password to database (sqlite don’t use it – you can set to empty or null)
- Save file.
- Open console/terminal in directory where is minetest.php and type in console and confirm [ENTER]:
php minetest.php -a createtables
- It creates tables in database.
- Type in console and confirm [ENTER]:
php minetest.php -a mapserver -o
- It download all mapserver:train blocks from MapServer and save train lines to database.
- It’s all. Open minetest.php in your web browser.
Refesh the data about train lines in database
When you add/remove stations (mapserver:train block) you need to update information about it in database.
Open console where is minetest.php file and type & confirm [ENTER]:
php minetest.php -a mapserver -o
its delete all old the data from database and download again the data from MapServer
Additional settings in minetest.php
- error_reporting(0)
- 0 – don’t show any errors
- E_ALL – show all errors
- set_time_limit(60)
- 60 [or any number] – max. time in seconds for executing code
- Please don’t set 0 – its means any limits for executing code
- 60 is ok, you can set lower number or higher but not too high
- ini_set(‘memory_limit’, ‘512M’)
- set max memory which may be used by script
- 512M – 512
Searching stations
Its simple, click on dropdown menu for start and end station and type letters (start, middle or end), e.g ‘es’, show all stations contains ‘es’ in name e.g.
next click on interest station for you.
Stats tab – show how many trains is running for each line now and number of railway stations