I want to check the quality of digitized tracks. I suppose, that a track with a lot of regular vertices has got a good quality. And a track with less regular vertices has got a poor quality.

enter image description here

Maybe, I need something like a heat map for lines?

  • I think it depends on the meaning of the polylines if vertex density is a good measure. For example roads, buildings or properties have straight edges. Rounded corners may be represented by curves. Contour lines may have many vertices but are poorly digitzed, because of poor georeference. Thus you need a measure for accuracy too. ISO 19000 family has a lot of useful info on this topic
    – Detlev
    Commented Jan 20, 2016 at 22:15

2 Answers 2


Have you tried this? A QGIS plugin to count polylines / polygons vertices and add a new column storing the number of vertices per feature.

This could help sorting poor quality / good quality lines from your approach.

EDIT : if you prefer doing so in PostGIS directly, try st_NPoints function. The following query calculates the number of vertices in a new field. You just need to alter your table and add the new column.

SELECT st_NPoints(geom) FROM schema.table ;
  • Yes, that is a good approach! If I count the vertices and divide them by the length of the line, I will get a "quality-number". That works! But if there would be a shorter way to calculate that number in my postgis-database it would be much better. Any Idea? Count vertices and divide by the length.
    – MartinMap
    Commented Jan 21, 2016 at 9:24
  • Just edited my post for PostGIS.
    – wiltomap
    Commented Jan 21, 2016 at 9:46
  • 1
    You could also add the no-postgis, no-plugin option with the field calculator: num_points($geometry) :) Commented Jan 23, 2016 at 11:43

Thinking of a way to visualise this.

I'm going by gut-feel here, so please forgive the vagueness :)

I'll assume that both tracks use the same CRS.

I assume that more detailed track is the 'baseline', and you want to measure how far away the other track is.

You could use PostGIS to connect each vertex on the baseline to the closest point on the less detailed line.

The length of each of these lines is the error for that vertex.

You could then sweep a 1D guassian kernel across the errors on the line to smooth out the error (e.g. using numpy/scipy). If you know Photoshop/GIMP, think "Guassian Blur", but on a line rather than a plane.

The smoothed error could then be used to style the width of the line (or the nodes).

  • Thanks for your idea, but I dont want to compare lines to get the one with the better quality. I want to check the quality for each line, which is given by the density of the veritices.
    – MartinMap
    Commented Jan 21, 2016 at 7:19
  • in that case, look up Kernel Density Estimation , which is the second part of my suggestion. A heatmap is usually just a KDE in 2 dimensions, sounds like you want the 1 dimension (line) version of this.
    – Steven Kay
    Commented Jan 21, 2016 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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