<?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 Random Sampling from huge point data in Spatial Statistics Questions</title>
    <link>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131805#M450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 35,000 points datasets. It is tedious to incorporate all points for my analysis. I am trying to generate random sample points in ArcGIS 9.3.1 platform. Is it possible run sampling technique in ArcGIS 9.3.1?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any kind of suggestion is welcome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2011 01:06:50 GMT</pubDate>
    <dc:creator>MilanBudhathoki1</dc:creator>
    <dc:date>2011-05-19T01:06:50Z</dc:date>
    <item>
      <title>Random Sampling from huge point data</title>
      <link>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131805#M450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 35,000 points datasets. It is tedious to incorporate all points for my analysis. I am trying to generate random sample points in ArcGIS 9.3.1 platform. Is it possible run sampling technique in ArcGIS 9.3.1?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any kind of suggestion is welcome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 01:06:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131805#M450</guid>
      <dc:creator>MilanBudhathoki1</dc:creator>
      <dc:date>2011-05-19T01:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Random Sampling from huge point data</title>
      <link>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131806#M451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is code in R. It requires the rgdal library. If you search around the forum there are some example scripts for calling R from ArcMap. Here is one example form the ESRI scripts page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=F855D6D1-1422-2418-A0B2-643E624A8925" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=F855D6D1-1422-2418-A0B2-643E624A8925&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;##################################################################
# PROGRAM: RandomFeatureSample.R
# USE: RANDOM SAMPLING OF SPATIAL OBJECTS
# REQUIRES: SP CLASS SpatialDataFrame OBJECT
#
# FUNCTIONS:&amp;nbsp; 
#&amp;nbsp;&amp;nbsp; RandSP(x, ns=10, reps=1, replace=FALSE) 
#
# ARGUMENTS: 
#&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP CLASS SpatialDataFrame OBJECT (POINT, POLYGON, LINE, PIXEL)
#&amp;nbsp;&amp;nbsp; n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER OF RANDOM SAMPLES
#&amp;nbsp;&amp;nbsp; reps&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUMBER OF REPLICATES (STRATA)
#&amp;nbsp;&amp;nbsp; replace&amp;nbsp; SAMPLE WITH REPLACEMENT (DEFAULT FALSE)
#&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPTIONAL ARGUMENTS TO PASS TO sample
#
# VALUE:
#&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBSAMPLE OF SP FEATURECLASS AS SAME SP CLASS
#
# NOTES:
#&amp;nbsp;&amp;nbsp; IF REPLACEMENT IS FALSE FEATURES ARE REMOVED FROM CONSIDERATION IN SUBSEQUENT 
#&amp;nbsp;&amp;nbsp; REPS&amp;nbsp; 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THIS MEANS THAT IF TRUE, THAT A FEATURE CAN BE SELECTED MULTIPLE TIMES ACROSS 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REPLICATES. NOT RELEVANT IF REP=1. 
#&amp;nbsp;&amp;nbsp; 
# EXAMPLES:
#&amp;nbsp;&amp;nbsp; require(rgdal)
#&amp;nbsp;&amp;nbsp; require(sp)
#&amp;nbsp;&amp;nbsp; # READ SHAPEFILE USING RGDAL
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shape &amp;lt;- readOGR(dsn="C:/test", layer="polys", driver="ESRI Shapefile")
#
#&amp;nbsp;&amp;nbsp; # CREATES 4 REPLCATES WITH 5 RANDOM SAMPLES EACH WITHOUT REPLACEMENT
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ssample &amp;lt;- RandSP(shape, n=5, reps=4, replace=FALSE) 
#
#&amp;nbsp;&amp;nbsp; # CREATES 1 REPLCATE WITH 10% RANDOM SAMPLE WITHOUT REPLACEMENT
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ssample &amp;lt;- RandSP(shape, n=round(dim(shape)[1]*0.10), digits=0), reps=1, replace=FALSE) 
#
#&amp;nbsp;&amp;nbsp; # WRITE RANDOM SAMPLE SHAPEFILE USING RGDAL
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeOGR(ssample, dsn="C:/test", layer="RandSample", driver="ESRI Shapefile")
#
#&amp;nbsp;&amp;nbsp; # PLOT RANDOM SAMPLES COLORED BY REPLICATE&amp;nbsp;&amp;nbsp; 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spplot(ssample, "REP", col.regions=terrain.colors(n=length(unique(ssample@data$REP))))
#
# REFERENCES:
#&amp;nbsp;&amp;nbsp;&amp;nbsp; B.D. Ripley, 1981. Spatial Statistics, Wiley 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
# CONTACT: 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jeffrey S. Evans 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Senior Landscape Ecologist 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The Nature Conservancy - Central Science
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Laramie, WY
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (970)672-6766
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jeffrey_evans@tnc.org
##################################################################
RandSP &amp;lt;- function(x, n=10, reps=1, replace=FALSE, ...)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!require(sp)) stop("sp PACKAGE MISSING")
 if (!inherits(x@data, "data.frame")) stop("MUST BE SP SpatialDataFrame OBJECT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; spx &amp;lt;- x&amp;nbsp;&amp;nbsp; 
 if ( dim(spx)[1] &amp;gt; n ) { 
&amp;nbsp;&amp;nbsp; s &amp;lt;- sample(1:nrow(spx@data), n) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results &amp;lt;- spx[s, ]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results@data &amp;lt;- data.frame(results@data, REP=1)&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(replace==FALSE) { spx &amp;lt;- spx[-s, ] } 
&amp;nbsp;&amp;nbsp; if(reps &amp;gt; 1) {
 for (i in 2:reps ) {&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s &amp;lt;- sample(1:nrow(spx@data), n) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ssamp &amp;lt;- spx[s, ] 
&amp;nbsp;&amp;nbsp; ssamp@data &amp;lt;- data.frame(ssamp@data, REP=i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results &amp;lt;- rbind(results, ssamp)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(replace==FALSE) { spx &amp;lt;- spx[-s, ] }&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; return( results )
 }
&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:23:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131806#M451</guid>
      <dc:creator>JeffreyEvans</dc:creator>
      <dc:date>2021-12-11T07:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Random Sampling from huge point data</title>
      <link>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131807#M452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The R package spsurvey can draw random samples, as well as spatially balanced probabilistic samples, so you might check out that package.&amp;nbsp; Here is a web site that describes some survey applications using spsurvey:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.epa.gov/nheerl/arm/"&gt;http://www.epa.gov/nheerl/arm/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 19:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-statistics-questions/random-sampling-from-huge-point-data/m-p/131807#M452</guid>
      <dc:creator>MichaelMcManus</dc:creator>
      <dc:date>2011-05-23T19:09:53Z</dc:date>
    </item>
  </channel>
</rss>

