AnyLogic
Expand
Font size

Converting GIS shapefiles to space markup shapes

If you are creating a rail model of some existing rail yard consisting of multiple railway tracks, you can go without drawing all the tracks manually using AnyLogic space markup shape railway track. Instead of this, you can simply find the GIS shapefile with the data on the existing railways, and convert this shapefile data to AnyLogic space markup shapes: railway tracks and switches. The railway network will be drawn automatically, and you will have just to make few adjustments.

This article describes how to convert GIS shapefiles to railway network shapes. AnyLogic also supports conversion to other space markup shapes and networks: roads, GIS networks, networks consisting of paths, and walls used in pedestrian simulation models. The conversion scenario is exactly the same in all cases, you should just choose the required type of the resulting network in the Convert to control (step 8 of the scenario).

To convert GIS shapefile data to AnyLogic railway network shapes

  1. Drag the  GIS Map element from the GIS section of the  Space Markup palette into the graphical editor.
    You can add GIS map only on the diagram that does not contain any rail road space markup shapes yet.
  2. You can use your own files, or find them on the web. You can download GIS data shapefiles e.g. from the https://diva-gis.org/data.html. On the web page, select Country (e.g. France), and select Railroads from the Subject drop-down list below. Download the data files as a .zip archive and extract them to some folder.
  3. Expand the Shapefiles section of the GIS map’s properties. Make this GIS map use the downloaded shapefile. Add a shapefile (with file extension “.shp”) by clicking the button.

  4. This opens the Open dialog box. Browse to the file you have downloaded, select it and click Open. The GIS map will show the file data, and the shapefiles will be copied to the model folder.
  5. To get the space markup elements with meaningful names (and not just items with random names like track145, track146), you should specify column of the shapefile containing the names of the items. Specify the index of the shapefile’s name column in the Name column index field located in the Shapefile section of GIS map properties. To find out the index of the name column, use third-party shapefile editors.

  6. Zoom in to the required part of the rail network (rail yard). This is very important to avoid converting numerous tracks that you really do not need in your model. Zoom in the GIS map until you see all the railway tracks you need to consider in your model.
  7. Right-click the GIS map and choose Convert Shapefile to Space Markup from the context menu.

  8. In the Convert Shapefile to Space Markup dialog box, select Railway in the Convert to list. Configure other options, and finally click OK.

  9. Confirm the action in next dialog boxes.

The conversion may take a relatively long time. Finally the GIS map will be substituted with the image. On top of this image you will see the rail network composed of AnyLogic’s Railway Track and Switch space markup elements.

How can we improve this article?