Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I know how to automatically assign numbers to a new point files using the $rownum function in the field calculator. However it does it from the top-left over and down like reading a book.

I could manually add the numbers myself that would be very time consuming in large point features.

What I'm wanting to do, as shown in the picture, is the top-left group of points to have them labeled 1 to 33 and the bottom-right group from 34 to the end.

Also, if I wanted to label the points vertically and start at the furthest top-left point and go down and then to the right, how would that be accomplished.

I'm sure that there is just some "code" I need to put into the field calculator but I do not know how.

enter image description here

share|improve this question

3 Answers 3

up vote 1 down vote accepted

I wanted to name the same method: As I can see, you could easily select features by rectangle here. Then in the attribute table you use the field calculator and use e.g. 34+$rownum, just as desired.Make sure to only update selected values by checking that box (only update selected features) above.This should work ok I think.

share|improve this answer
    
Thanks so much all of you for your help. This worked great and was exactly what I needed. –  Jeremy Jun 28 '12 at 22:57
    
Do any of you know where a good training or resource place is to learn more about the field calculator and what the various functions and characters do and how to use them? –  Jeremy Jun 28 '12 at 22:59
    
You re very welcome. There surely is a list with the functions: hub.qgis.org/wiki/17/List_of_Field_Calculator_Functions But if you ask for good training/examples I can t help( I myself looked for it too). So I guess I m starting now to gather exaples for it in order to share them sooner or later. –  Shepherdjo Jun 29 '12 at 6:25

Sorry, $rownum is the row number and has absolutely nothing to do with how the features are arranged on the map.

You could select all points in the left polygon and calculate an id such as 100+$rownum and do the same with the right one but 200+$rownum. That won't result in consecutive ids, but depending on the use case it might be enough.

share|improve this answer
    
Do you know where a good training or resource place is to learn more about the field calculator and what the various functions and characters do and how to use them? Basically to expand my knowledge on the "coding" in the field calculator? –  Jeremy Jun 29 '12 at 5:23

Two concepts might help,

Use the mmqgis plugin to label the points by hub. You would create a new layer which is the hub to the top left.

Or create an index of the points based on their x and y using the field calculator commands $x $y. And follow this up with some calculation and then rank/sort the result.

Obviously the detail is yours to find by trial and error.....

ciao

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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