Glacier length is a key parameter in global glacier inventories, but difficult to determine in a consistent way and subject to frequent change. Its vector representation (a flow line) is a most important input for modeling future glacier evolution, but only seldom available from digital databases. Hence, there is an urgent need to generate such flow lines for a large number of glaciers from automated methods. We here present a new algorithm that is based on Python scripting and additional libraries (GDAL and OGR) and requires only a DEM and glacier outlines as an input. The core of the method is based on a glacier axis concept that is combined with geometry rules such as the k-d Tree, Nearest Neighbor and crossing test theory. We have applied the method to 400 glaciers located in Western Alaska, where a new glacier inventory was recently created. The accuracy of the method was assessed by a quantitative and qualitative (outline overlay) comparison with a manually digitized dataset for 20 glaciers. This comparison revealed for 17 out of the 20 glaciers a length value within the range of the manual digitizations. Other potential methods performed less well. Combined with previous glacier outlines from the same region (Digital Line Graph) we automatically determined length changes for 390 glaciers over a c. 50 year period.