I'm building a model in 'graphical modeler' in QGIS 2.2.

I want my model to clip a polygon layer and give the polygons coordinates so that I could sort them geographically from north to south. After sorting them, I want to add a number to each polygon to be able to save the sorted order.

I have, with some help from this forum, been able to add coordinates to the polygons using the modeler. So far, everything is good.

My next step would be to get the polygons sorted from north to south. I have done these last few steps manually, sorting the polygons in the attribute table, added a column with "sorting number", and then saving the sorted order using MMQGIS - 'Modify' - 'Sort'.

Is it at all possible to do something similar inside the graphical modeler? I'm going to do this mulitple times, so it would be a real timesaver to get as many steps as possible inside the modeler.

  • Does this question deal with similar issues? gis.stackexchange.com/questions/44440/…
    – Willy
    Commented May 6, 2014 at 11:14
  • @Willy Yes, I guess in a way it does. And I know how to do what I want manually, I think you where the one who help me with that in another thread. This time I'm trying to do it inside the modeler. If I understand the linked question right, the problem is addressed outside the modeler?
    – SoS
    Commented May 6, 2014 at 12:01

1 Answer 1


One simple process and available in Model builder is:

  1. Use FIeld calculator
  2. Formula:

    distance($geometry, geom_from_wkt('Point (149451.55066836 189178.84799332)')) 

    where the point is above your polygon in North direction. You can stop now or continue point 3.

  3. In spreadsheet, do a semi automatic classification by creationg groups. Then do one first sort on this group then the second on distance and finally make an incremental numbering. Then join the spreadsheet.

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.