2

I'm trying to smooth a LineString through 1D Gaussian Smoothing and I'm having a doubt on the steps required to implement it, regardless of programming language. I couldn't find by myself anything explaining how to do it.

The linestring is a vector of coordinates, each having longitude and latitude. I'm supposed to use a 1D Gaussian Smoothing method, so that means I have to pass 2 times on the coordinates. I'm not very used to this kind of subject, so I'm a bit confused on how to apply this method.

If anyone had any experience doing this, I'd like to receive documentation or articles on the subject.

(Analogy) I'm trying to do what the least squares method does to XY coordinates. We feed it with the coordinates and calculate using some degree (linear, quadratic, etc.), then we'd get the best fitting polynomial. But in my case, I have to smooth both axis (longitude and latitude) using the 1D Gaussian filter.

0

I have implemented such algorithm in Java using JTS. Here is the source code: https://github.com/jgaffuri/OpenCarto/blob/gh-pages/src/main/java/org/opencarto/algo/line/GaussianLineSmoothing.java

The main steps are the following:

  1. Densify the input line with additional vertices along each segment.
  2. Prepare gaussian coefficients.
  3. Compute the position of the smoothed geometry as the average of the neighbor points, weighted by the gaussian coefficients (that is the trickiest part).
  4. Filter (with Douglas-Peucker) the final line to remove unnecessary vertices.

See below how it looks like: The black line shows the input line and red lines show smoothed versions with increasing smoothing parameter.

line smoothing JTS java

Note that closed lines are handled.

  • I should push it to JTS maybe. – julien Sep 17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.