Turning building polygons into point symbols with right angle using QGIS

Right now I’m working on a project where the scale is to small to use the actual building forms in the map. Therefore I have to convert these buildings into point objects which in the end will be larger than the actual buildings.

First I calculate the area of each polygon and store that in an attribute field using the Field Calculator.

Then I convert the polygon into a line object and use this (modified) expression found here in the Field Calculator and add that to another attribute column.

(atan((xat(0)-xat(1))/(yat(0)-yat(1)))) * 180/3.14159 + (180 *(((yat(0)-yat(1)) < 0) + (((xat(0)-xat(1)) < 0 AND (yat(0) - yat(1)) >0)*2)))

After that I create a point file using the Polygon Centroids function of the polygon layer.

Then I join the attribute data from the Centroid file with the line object that has the angle of the building stored in one attribute column.

Now I can use this layer in MAPublisher using the angle field to ge the right angle of the point object.

(a longer, more in detail version of this post will be published here soon)


Write a comment