Thursday, March 3, 2011

GeoTools Route Calculation

EDIT: THIS POST HAS BEEN REPLACED BY THE MORE RECENT BLOG POST FOUND HERE
 http://usefulpracticalgeoblog.blogspot.ch/2012/09/geotools-routing.html

Java Classes to calculate network distances between an origin and several destinations. Uses Geotools 2.7 library and JAI library, details of where to download them can be found in the Main class. Takes as input ESRI shapefiles for the network and destinations and outputs either a FeatureSource containing the routes and associated costs or just an arraylist of costs (which is here the euclidean distance) and objectIDs.

https://sites.google.com/site/usefulpracticalgeoblog/home/routecalculationexample

Also included are the two shapefiles for use with the example Main Class. When used on other datasets make sure the CRS and SRID values reflect the datasets to which they are applied, otherwise I imagine an error frenzy will ensue :-)