<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 17, 2015 at 5:30 PM, Markus Neteler <span dir="ltr"><<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Feb 17, 2015 at 4:49 PM, Margherita Di Leo <<a href="mailto:diregola@gmail.com">diregola@gmail.com</a>> wrote:<br>
</span><span class="">> Hi,<br>
><br>
> I have a vector of points. According to a regular grid, I need to (randomly)<br>
> sample a certain number n of these points in each cell of the grid. Such<br>
> number n is given in a column of the attribute table of the grid. How would<br>
> you do this?<br>
<br>
</span>With a small script this should be doable:<br>
- generate the grid as polygons (v.mkgrid)<br>
- loop over each polygon<br>
     - fetch category number or v.extract<br>
     - fetch corresponding number of points to be created from DB<br>
     - v.random, using the current grid polygon for restricted creation feature<br>
        <a href="http://grass.osgeo.org/grass70/manuals/v.random.html#restriction-to-vector-areas" target="_blank">http://grass.osgeo.org/grass70/manuals/v.random.html#restriction-to-vector-areas</a></blockquote><div><br></div><div>Here lies the problem. I need to randomly pick points that are already existing. Example: for grid cell that has ID 42, I have 50 points, and have to randomly pick 7 out of these 50.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
     - save point map<br>
- patch all point maps into single resulting map<br>
- remove single point maps<br>
<br>
Something like this...<br>
<span class="HOEnZb"><font color="#888888"><br>
Markus<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><font color="#666666">Best regards,</font></div><div><font color="#666666"><br></font></div><div><font color="#666666">Dr. Margherita DI LEO    </font></div><div><span style="color:rgb(102,102,102);font-family:arial;font-size:small">Scientific / technical project officer</span><br></div><div><font color="#666666"><br></font></div><div><font color="#666666">European Commission - DG JRC </font></div><div><font color="#666666">Institute for Environment and Sustainability (IES)</font></div><div><font color="#666666">Via Fermi, 2749</font></div><div><font color="#666666">I-21027 Ispra (VA) - Italy - TP 261</font></div><div><font color="#666666">       </font></div><div><font color="#666666">Tel. +39 0332 78 3600   </font></div><div><font color="#666666"><a href="mailto:margherita.di-leo@jrc.ec.europa.eu" target="_blank">margherita.di-leo@jrc.ec.europa.eu</a></font></div><div><font color="#666666"><br></font></div><div><font color="#666666">Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission.</font></div></div></div>
</div></div>