Q: Raster to vector -> vector to mean line with one attribute I am using QGIS and I need to calculate the minimum distance from points to line.
I have the points in .txt format and this is ok, but I have to extract the line from the raster file showed the following figure:

So I made "raster to vector" and I have this situation

The vector file contains, of course, a lot of id values. 
My purpose is to have only 1 id value, that is having only a line shapefile.
I tried also to convert the vector file in lines, but the output was the following:

I would like to have only 1 line (like a "mean" line) which has only 1 attribute so that I can calculate the minimum distance from points.
Of course, if you know a different procedure to calculate the minimum distance between points and a raster, it is welcome.

A: I believe the GRASS GIS tool r.thin, available from the QGIS processing toolbox applies to your problem. Citing the GRASS manual it 'thins non-NULL cells that denote linear features into linear features having a single cell width.' After applying r.thin to your raster you can use r.to.vect specifying line as the feature type.
Both tools are available in the processing toolbox. Here are the GRASS manual pages:
https://grass.osgeo.org/grass78/manuals/r.thin.html
https://grass.osgeo.org/grass78/manuals/r.to.vect.html
If you end up with multiple line segments you can use v.clean with the snap option to snap lines to vertices within a specified threshold. This, and various other options for combining multiple lines are discussed here: How to merge lines with slightly different endpoints in QGIS? 
Distance from points to the final vector line can then be found by use of v.distance, for example. This and some other options are given in answers to this question:
Measuring the distance between lines and points in QGIS
