Archive for the ‘Programming’ Category

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.

Segmenting LineStrings of arbitrary length with GeoTools

Posted on May 26th, 2014 by Dalton Filho

This post demonstrates a simple algorithm implemented in GeoTools to divide LineString objects into segments of arbitrary length. Our task is to divide Montreal’s Grand Prix Track into segments of 100m. The implementation of this functionality will require the concept of interpolation of points within a line, which serves as the basis for several other GIS algorithms.