Converting GIS shapefile to a road network
If you are creating a road traffic model of some existing road network,
you can go without drawing all the roads and intersections manually
using road space markup shapes. Instead of this, you can simply find
the GIS shapefile with the data on the existing roads, and convert this
shapefile data to AnyLogic road space markup shapes. The road network
will be drawn automatically, and you will have just to make few
adjustments (change the road network's
Lane width, number of forward and backward lanes of individual
roads, etc.).
To convert GIS shapefile data to AnyLogic road network shapes
- Drag the
GIS Map
element from the
GIS
section of the
Space Markup
palette into the graphical editor. Note that you can add GIS map only
on the diagram that does not contain any road space markup shapes yet.
- You
can use your own files, or find them on the web. We will demonstrate
the feature by downloading and converting Toulouse shapefile from http://www.geofabrik.de/data/shapefiles.html. Download the data files as a .zip archive and extract them to some folder.
- Expand the
Shapefiles
section
of the GIS map's properties. Set this GIS map to use the downloaded
shapefile. Add a shapefile (with file extension .shp) by clicking the
button.

- 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.
- To get the space markup elements with meaningful names (and not just randomly named like
road145,
road146), you should specify what column of the shapefile contains the names of the items. In the
Shapefile
section of GIS map properties, specify the index of the shapefile's name column in the
Name column index
field. To know the index of the name column, use third-party shapefile editors.
- Zoom
in to the required part of the road network. It is very important to
avoid converting numerous roads that you really do not need in your
model. Zoom in
the GIS map until you see all the roads you need to consider in your model.
- Right-click the GIS map and choose
Convert Shapefile to Space Markup
from the context menu.
- In the
Convert Shapefile to Space Markup
dialog box, select
Roads
in the
Convert to
list. Configure other options, and finally click
OK.
- 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 road network
composed of AnyLogic's
roads
and
intersections
(see the figure below).
Note:
All drawn roads are two-way. Each road has two forward lanes and two
backward lanes. You need to modify the road attributes by yourself.
Data on road speed limits etc. is neither read nor used by AnyLogic's
road network.

Related topics
Road network
Road
GIS map
Road Traffic Library tutorial