Question: I am stuck with placing Label on the Grid lines. Below is the data grid on the map. I created the grid using data driven pages.
After I turned on the Label, the labelling appeared inside the grid. I want it to be placed on the line itself with a little buffer around it. I have explored the placement properties of the grid layer and it looks as if there is no option there[![Current Grid](https://i.stack.imgur.com/f0B6B.jpg)](https://i.stack.imgur.com/f0B6B.jpg)

I wish I could placed the Labeling on the gridLines/borders instead of inside the grid.

Answer: 
Just a hint if you can't find the `Polygonize` tool. In my QGIS 2.18.3 installation (Windows) I could not find the `Polygonize` tool at `Vector geometry tools` within the Toolbox. It took me some time to realize that I needed to install the `python-shapely` library with OSGeo4W (thanks [Nick Hopton : Perfect Polygons in QGIS](http://confound.me.uk/maps/ppv4.pdf)).
I had the same unwanted output and after doing some research it seems the cause can vary.

**My case was** I had some polyline layers with very, very small gaps (in which some fragments were formed by two or less nodes) (Figure 1 and Figure 2).

So, after directly running `Lines to polygons` tool, the algorithm would run, but no polygon would be created. A warning would appear:

> 
> One or more line ignored due to geometry not having a minimum of three vertices.
> 
> 
> 

I discovered them by running `Topology Checker` ('Must not have dangles' rule) which would result in multiple 'dangling end' errors (Figure 3).

**I fixed it** with the following steps:

* Converting the lines to points (`Extract vertices`).
* Converting back points to lines (`Points to path`), setting the 'Order field' parameter as 'Vertex index'.
* Converting the lines (paths) to polygons (`Lines to polygons`).

Using QGIS 3.14.1 version.

---

Figure 1. Polyline in map canvas after loading the layer.

[![enter image description here](https://i.stack.imgur.com/YvdtP.png)](https://i.stack.imgur.com/YvdtP.png)

Figure 2. A very, very small gap (zoom+ is at maximum).

[![enter image description here](https://i.stack.imgur.com/NQMjK.png)](https://i.stack.imgur.com/NQMjK.png)

Figure 3. Errors appointed by the 'Topology Checker' tool.

[![enter image description here](https://i.stack.imgur.com/E4xj9.png)](https://i.stack.imgur.com/E4xj9.png)