Sunday, September 2, 2012

Updated GeoTools Routing Example

I have updated the code example for the GeoTools routing that I had earlier on this blog. You can find the code and example datasets below is the latest code example. It contains a folder with the necessary Java classes and two .shp files. One file contains the network dataset for Vienna, Austria (available from, the other contains two destinations for the example code. It requires Geotools 2.7 libraries to run. I have tried to comment it heavily to make it clear. It uses only the distance information to calculate the weights of the edges, but that can easily be changed to incorporate anything else, such as travel time etc. This code example calculates the route from one origin to two destinations (green points on screenshot below).

Here is a screenshot of the output :