Archive for August, 2014

Projecting a point onto a line using GeoTools

Posted on August 17th, 2014 by Dalton Filho

In this post I will describe how to implement an algorithm to project a point onto a line. There are numerous formulas to achieve this — most of which terser than the method described here — but their scope is also narrower: they assume your point is already projectable onto the line. Here I will widen the scope and describe not only how to project the point in a didactic way, but also how to test if the point is projectable and provide a GeoTools/JTS implementation.