1

I have a layer of points and I want to add a column with an index according to the coordinates. I already thought about sorting the UTMX and UTMY coordinates, but still the result doesn't convince me, so I tried to multiply these coordinates to get a third column and sort this one. Likewise, I am not sure if this is the result I am looking for, so is there a simpler way in QGIS?.

Here is an image of the layer with the indexes to order, the idea is from left to right or from one corner to the other.

enter image description here

The result would have to look like this for the example from top left to bottom right.

enter image description here

  • Can you provide an example of what you're trying to achieve? – Erik Jun 02 '22 at 13:29
  • so on the "top left" corner you would like to start with one and at the "bottom right" you want to end with the highest number? Is it always some kind of rectangle? – Bernd Loigge Jun 02 '22 at 13:32
  • Yes, that's right. It does not always have a square shape, but it does have a high density of dots. – Victor Manuel Barrios Barrios Jun 02 '22 at 13:47
  • array_find(array_agg($id,order_by:=to_string($x)||'_'||to_string($y)),$id)? Otherwise please provide exact informations on how to sort the points. – MrXsquared Jun 02 '22 at 13:52
  • In field calculator, array_find(array_agg($id,order_by:="x"*"y"),$id)+1, this creates an index form "bottom left" to "top right". And array_find(array_agg($id,order_by:="x"-"y"),$id)+1, creates a aproach to "top left" to "bottom right". This is the closest approximation. I guess you have to look for a better combination. I leave it here for other people to use. – Victor Manuel Barrios Barrios Jun 02 '22 at 14:42
  • Maybe see here for inspiration: https://gis.stackexchange.com/a/361838/88814 – Babel Jun 07 '22 at 13:53

0 Answers0