Select to view content in your preferred language

How can "randomly" select from previous selection?

744
2
10-20-2012 07:05 PM
EhsanDadvar
Deactivated User
Dear all, hello

I have a shapefile (including 25096 records) which I need to make sampling based on different scenarios and at the end have the final samples (which some may be common in some scenarios).
So I thought of doing selection based on some criteria for some attributes in "Select by attributes" to figure out the pool for each scenario and then doing random selection in previous selection and keeping the selected records with a new field which indicates the selection of that scenario and going to the next scenario.
I guess SQL for "Select by attributes" for shapefile may not support some expressions like "Select Rand()" or "Top".
I think Python has some good abilities for random selection and also can provide what I want but unfortunately, I am not good in programming so I cannot translate what I think in Python.
I use htools of Hawth's Analysis Tools for ArcGIS for regular random selection but it does not keep previous selection; any pre-existing selection of features is lost.

I will appreciate your response.

Kind Regards
--
Ehsan
0 Kudos
2 Replies
T__WayneWhitley
Honored Contributor
Let's build on what you are already are working with.  Maybe you have already thought of this, but I don't see why you cannot rename the resulting RNDSEL field (or calculate values to a new field) in successive executions RNDSEL_1, RNDSEL_2, ... etc., so that no selections sets are lost.  Unless you mean to automate the whole process of producing the random sets?

Also, with the added field, you can choose whether or not you want certain sets included or not in other 'populations' for the possibility of being 're-selected'.  And you can simply export the selections to new 'exclusive' sets (and run them again exclusively if you want a 'subset' sampling).

Does that solve your problem?  If not, then yes, this can otherwise be done via Python, etc.
0 Kudos
EhsanDadvar
Deactivated User
Let's build on what you are already are working with.  Maybe you have already thought of this, but I don't see why you cannot rename the resulting RNDSEL field (or calculate values to a new field) in successive executions RNDSEL_1, RNDSEL_2, ... etc., so that no selections sets are lost.  Unless you mean to automate the whole process of producing the random sets?

Also, with the added field, you can choose whether or not you want certain sets included or not in other 'populations' for the possibility of being 're-selected'.  And you can simply export the selections to new 'exclusive' sets (and run them again exclusively if you want a 'subset' sampling).

Does that solve your problem?  If not, then yes, this can otherwise be done via Python, etc.


Thank you for your response. It will be helpful to rename RNDSEL but I think not for current problem as I should repeat the process for about 11 sampling strategies and about 80 subsets, it is valuable to find such an automatic procedure via ModelBuilder using VB or Python.
0 Kudos