I have created a point feature from a 30 meter DEM raster and I would like to reduce the number of points (decimate) - the number of points are too large to manage. Is there a toolbox for this or can this be done with the select attribute tool. Thanks.
Solved! Go to Solution.
Another option is to simply resample the raster down to an even lower resolution before converting to points.
probably many options, but you could add a field to the table and calculate a random number for the field , then select the number of features you want. If you want to do a rondom-y stratified-ish sample, you could calculate add a field and use the field calculation on either the X and/or Y
!shape!.centroid.X % 2 ( I think) which will calculate a binary value indicating whether the coordinate is even or odd...then query out your choise and save them. So decide whether you need random, random with a minimum number of samples, points with a minimum spacing etc etc.
Field calculations are here if you need examples. Calculate Field examples—Help | ArcGIS for Desktop
I don't think this is really a Python question, more of a geo-processing problem (python being one solution).
Assuming you have a Shapefile then your row id is "FID". The following Where clause can be used in the Select by Attribute and it will select the first and every tenth row:
"FID" / 10 = round( "FID"/10,0) or "FID" = 1
If your dataset is a geodatabase feature class then substitute FID with ObjectID.
You can then either delete these or invert the selection and delete out the batches of 9 rows. If the second option is what you want it will be quicker to simply export the selected 10th rows.
Duncan, I didn't mean to suggest it was a python problem, however, python in the field calculator etc allows for builtin random module access making random number generation easier etc.
Dan, I was not thinking your answer was unsuitable more that the original question is located under the python discussion board and that it is seems more suited to the general geo-processing page. If I had the power I would be moving it into that section.
Duly noted but I was originally considering applying a Python script to execute this. I couldn't figure out the code to use in 'select by attribute' to delete rows in the table.
Thanks for your help.
Chris, If Dan's or my suggestion solves your problem you should tick it as such, shows to others a solution was found and we get lots of lovely points!
Duncan,
I'm going to try this. I assume I need to start an edit session in order to delete the records in the attribute table?
You can or you can simply use the Delete Features geoprocessing tool! A warning about this tool, if no selection exists then it Deletes EVERYTHING and there is no undo for this tool! So if you are building a model to run this many times it would be sensible to put in a GetCount and use that as a precondition to the Delete Features tool, otherwise you may end up shooting yourself in the foot.
This was a great help.
I just adjusted the "10" counts until I got the spread I was seeking, which ended up being "6".
Sweet!