0

I have bathimetry data in .shp format. The points (picture below shows one of multiple groups/profiles) do not have ID numbers and are randomly dispersed through the attribute table.

enter image description here enter image description here

I have selected each group and added group ID to it. Now each point has "Sort" attribute that serves as the group ID. I still need each individual point to have ID number within the group.

I need these points numbered starting with the northernmost point in group (Field2 in attribute table is northing) and ending with the southernmost. So, a point with highest "Field2" value gets value of 1 in "point_num" field.

Basically, what I need to do is sort selected points according to value of "Field2" attribute. How can I do this with (preferably) QGIS field calculator or some other tool?

1

In QGIS 3.0, there is a tool Order by expression which enables you to sort a field Ascending or Descending:

enter image description here

The Ascending is selected by default. If you want Descending just deselect Ascending and it should work.

The tool can be accessed from Processing Toolbox -> Vector General -> Order by expression

  • Ok, this sorting tool works, thanks! Is it possible to do this in existing layer without creating a new one? Also, I need to add numbers from 1 to 55 to these "point_num" attribute after ordering by 1.2 "Field2". – Marin Leontenko Apr 12 '18 at 12:19
  • 1
    No. The tool creates a new file which is very common when dealing with processing tools. If this answer solved your problem, please accept it and if you have a new question, it is better to ask on separate thread. – ahmadhanb Apr 12 '18 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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