<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I need to randomly select polygons from feature class... in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361688#M12487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Before I migrated to ArcGIS 10 vesrion, i used very handy free tool (extension) &lt;/SPAN&gt;&lt;STRONG&gt;Hawth's Analysis Tools for ArcGIS&lt;/STRONG&gt;&lt;SPAN&gt;, and id had exactly tool that you need called &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;CREATE RANDOM SELECTION TOOL&lt;/SPAN&gt;&lt;SPAN&gt; link: &lt;/SPAN&gt;&lt;A href="http://www.spatialecology.com/htools/rndsel.php"&gt;http://www.spatialecology.com/htools/rndsel.php&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;I used that for caclulation of DEM RMSE for my master thesis, and it worked perfectly ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, tool is abandoned and there is no version for ArcGIS 10 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Apr 2012 17:42:57 GMT</pubDate>
    <dc:creator>UrosDjuric</dc:creator>
    <dc:date>2012-04-09T17:42:57Z</dc:date>
    <item>
      <title>I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361686#M12485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to randomly select a specific number of polygons from a feature class and create a new feature class with the randomly generated polygons. Is there a way to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 16:11:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361686#M12485</guid>
      <dc:creator>BryanReiley</dc:creator>
      <dc:date>2012-04-09T16:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361687#M12486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may want to use &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003000000012000000.htm"&gt;Subset Features&lt;/A&gt;&lt;SPAN&gt; tool, provided you have Geostatisical Analyst extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, please look the following forum post:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/30817-points-sampling"&gt;&lt;BR /&gt;http://forums.arcgis.com/threads/30817-points-sampling&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 16:56:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361687#M12486</guid>
      <dc:creator>TarunJaiswal</dc:creator>
      <dc:date>2012-04-09T16:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361688#M12487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Before I migrated to ArcGIS 10 vesrion, i used very handy free tool (extension) &lt;/SPAN&gt;&lt;STRONG&gt;Hawth's Analysis Tools for ArcGIS&lt;/STRONG&gt;&lt;SPAN&gt;, and id had exactly tool that you need called &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;CREATE RANDOM SELECTION TOOL&lt;/SPAN&gt;&lt;SPAN&gt; link: &lt;/SPAN&gt;&lt;A href="http://www.spatialecology.com/htools/rndsel.php"&gt;http://www.spatialecology.com/htools/rndsel.php&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;I used that for caclulation of DEM RMSE for my master thesis, and it worked perfectly ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, tool is abandoned and there is no version for ArcGIS 10 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 17:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361688#M12487</guid>
      <dc:creator>UrosDjuric</dc:creator>
      <dc:date>2012-04-09T17:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361689#M12488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I used Hawth's Tools previously but they changed to a new, less user friendly version called Geospatial Modelling environment that uses the Stats progrom R, etc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 17:47:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361689#M12488</guid>
      <dc:creator>BryanReiley</dc:creator>
      <dc:date>2012-04-09T17:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361690#M12489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use a search cursor to create a python list of your feature ids, and feed that list to &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the python random module's random.choice(seq) function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;add the resulting selected feature id to a new list and remove that id the first list (so you don't pick it twice)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use alist.remove(x) to remove it from the first list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do these steps again and again untill you have the desired number of feature ids in the second list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;make your feature selection on the feature ids that second list&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Most of the stuff in Hawth's Tools is not hard to do outside the tool set, just a little tedious sometimes....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 16:11:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361690#M12489</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-04-10T16:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: I need to randomly select polygons from feature class...</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361691#M12490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just ran into this same question, and ended up using&amp;nbsp;the python &lt;A href="https://docs.python.org/3/library/random.html#sample" rel="nofollow noopener noreferrer" target="_blank"&gt;random.sample&lt;/A&gt; function directly to create a subsequence of rows from the original search cursor, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;all_addresses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getValue&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"survey_master_address_list_2018"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; random
sample_set &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; random&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sample&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;all_addresses&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sample_size&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried a few times to just use row objects directly and found that there were weird reference issues, so it works best to pull a list of FID values, sample those, and then you can loop back through the layer using an UpdateCursor and check for `row.FID in sample_set` to then perform operations on the sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/i-need-to-randomly-select-polygons-from-feature/m-p/361691#M12490</guid>
      <dc:creator>TimStallmann</dc:creator>
      <dc:date>2021-12-11T16:52:19Z</dc:date>
    </item>
  </channel>
</rss>

