<div dir="ltr">Hey, thanks for the answer, and nice catch !<div>I'll try to simply buffer points,</div><div>then try th eother method to count</div><div><br></div><div>About performance : </div><div>this is not about plpgsql or C.</div>
<div>I did quit the same processing when importing files of 3 millions points to split into small 1*1*1 m cubes.</div><div>There were a lot of cubes (around 2k for 3 millions points), a lot of points (3 millions) with a lot of attributes (around 20 flaot/double per point), and it was around 60 sec/ file (for the data processing. Data reading from disk was little longer).</div>
<div><br></div><div><br></div><div>For a 50x50 pixels and a few thousand points I would expect around 200ms.</div><div><br></div><div><br></div><div>I suspect it all boils down to current pixel access mechanism.</div><div>
<b>Can you please confirm if there is or isn't a method to set/get several pixels at a time?</b></div><div><br></div><div>Thanks anyway,</div><div>I wouldn't have found =)</div><div><br></div><div>Cheers,</div><div>
Rémi-C</div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/19 Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">"MEAN_OF_VALUES_AT_PIXEL_CENTROID", which is the default ST_ExtractToRaster() method, search for geometries intersecting with the centroid of the pixel (a point). That's the method you use both calls to ExtractToRaster(). As it's almost impossible that a point intersects a point, this is certainly not the right method to get the value of points inside the pixel. A proper method would be "MEAN_VALUE_OF_POINTS" or "MEAN_VALUE_OF_GEOMETRIES" or "FIRST_GEOMETRY_VALUE" which are not implemented...<br>

<br>
I suggest you try 'COUNT_OF_POINTS' for now which will set each pixel value to the number of point intersecting with it. If you get it to work and you're satisfied with the performance I could help adding a method for your specific need.<br>

<br>
Can't do anything about the performance. All this is pure pl/pgsql and it's as fast as it can. 5 seconds to compute 2500 pixels value using SQL is not that bad though if you're not on the web... Otherwise you should have a specific C function doing exactly what you want. Expect time and $$$.<br>

<div class="im HOEnZb"><br>
Pierre<br><br></div><div class="HOEnZb"></div></blockquote></div><br></div></div></div>