I have a large shapefile with 2,5 million points and I would like to create a new field in the attribute table that groups the features into groups of 65000 features.
In other words: Select the first 65000 features, field calculator: = 1, select the next 65000 features, field calculator: = 2 and so on.
-
2I guess you didn't do the first and most obvious thing and that was to read the Help file? The code for the tool you need to use is all here.Hornbydd– Hornbydd2019年07月22日 10:54:03 +00:00Commented Jul 22, 2019 at 10:54
-
1Welcome to GIS SE. As a new user, please take the Tour, which explains how our "Focused question/Best answer" model operates. Questions should demonstrate an effort to solve the problem; coding questions should include code. Failure to show due diligence toward solving the problem on your own may result in downvotes, closure, or just having your question ignored.Vince– Vince2019年07月22日 12:36:05 +00:00Commented Jul 22, 2019 at 12:36
1 Answer 1
Try using the object identifier (FID or OBJECTID field). If you divide it by 65000 and convert the result to integer (equivalent to floor), then you will have your groups.
int(floor(!FID!/65000))
note that you could use ceil() instead of floor() if you prefer to start at 1 instead of 0.
-
That's what I was looking for - an easy way for non-programmers. Thank you!lmft– lmft2019年07月22日 12:17:03 +00:00Commented Jul 22, 2019 at 12:17
Explore related questions
See similar questions with these tags.