The location of level crossings for pedestrian circulation is a safety issue due to potential human losses and material damage. This problem has become a concern in urban and industrial environments due to the characteristics of rail systems and unsafe pedestrian behaviour. Research reveals that psychological and infrastructural factors influence pedestrians' decision-making when crossing railroad lines. One of these is the convenience that leads pedestrians to cross at the nearest point. However, investigations to date only study the impact of location on the risk and severity of crashes and pedestrian rule violations. The current research is quasi-experimental, i.e., no optimisation tool has been developed to determine which crossing points pedestrians should follow. Therefore, this research develops a mathematical model for locating level crossings at railways to minimise the total weighted-walked distance. A genetic algorithm was proposed for solving the model, especially for large-size problems. The algorithm parameters were calibrated using the design of experiments and ten instances based on the characteristics of the area under study. The obtained results provide (1) the location of the level crossings and (2) the route pedestrians should follow for each origin-destination pair based on the facilities adjacent to the rail lines. A sensitivity analysis was performed using the ten instances to determine how the location of the level crossings changes with modifications in the facilities' location. Results showed that the model provides alternative solutions according to the problem's size. This study delivers a methodology for practitioners and stakeholders of transportation systems.