I had a project where I needed to read the pixel values from a large mosaic for several hundred points.  The fastest method I was able to come up with for the query was to write a Python script that did the following:<br><br>
- open the raster with gdal<br>
- use the point coordinates as input parameters to a function that calculates the correct raster row and column based on the dimensions of the raster, and its pixel dimensions<br><br>The IO for this tool was crude, as I used a delimited text file to contain all of the points of interest, but it worked.<br>

<br>Before that, I had also "vectorized" a fairly coarse resolution raster and stored the pixel geometries as polygons in PostGIS.  It worked very well for doing relational queries against other data sets, but was murderously slow for the renderer to style and display.<br>

<br>In both of these examples, I have not come up with a good way to extract a specific sub-region of the data based on pixel values and return a raster.  Pulling out bounding boxes via the "gdal_translate -projwin" function is trivial though, so maybe if all you want to do is retrieve an area that surrounds a point, or contains a group of points, you could do that?<br>

<br>A combination of these methods (geometry in PostGIS, raster on disk) might be a good solution.  I've attached the Python scripts I used for the vectorizing, and the raster lookup, in case they might be useful starting points.<br>
<br>Best of luck,<br><br>Roger<br>--<br><br><div class="gmail_quote">On Fri, Apr 17, 2009 at 8:44 AM, yoda2nd <span dir="ltr"><<a href="mailto:yoda2nd@niacc.org" target="_blank">yoda2nd@niacc.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Actually I saw that WKT Raster was avalible, but I was unsure about it with it only in the beta stages and there does not appear to be much in the way of documentation yet.  I did check out the read me file in the SVN repository, and it seems to conflict with the documentation. <br>


<a href="http://trac.osgeo.org/postgis/wiki/WKTRaster/Documentation01" target="_blank">http://trac.osgeo.org/postgis/wiki/WKTRaster/Documentation01</a><br>
<a href="https://svn.osgeo.org/postgis/spike/wktraster/README" target="_blank">https://svn.osgeo.org/postgis/spike/wktraster/README</a><br>
<br>
The read me file says that it will not work with the current version of PostGIS, but the online documentation says it will.  Not sure which one is correct.<br>
<br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
I've done this before using a similar approach you have and using GDAL to<br>
read the elevations from the GeoTiff and dump them into an elevations table<br>
with point geoms.  If I had to do it again, now that we have WKT Raster in<br>
the works, I'd probably try that if you don't mind compiling yourself.<br>
<br>
<br>
<a href="http://trac.osgeo.org/postgis/wiki/WKTRaster" target="_blank">http://trac.osgeo.org/postgis/wiki/WKTRaster</a><br>
<br>
Mateusz has a nice test drive example of WKTRaster <br>
<a href="http://mateusz.loskot.net/2009/03/30/crunching-wkt-rasters/" target="_blank">http://mateusz.loskot.net/2009/03/30/crunching-wkt-rasters/</a><br>
<br>
<br>
Hope that helps,<br>
Regina<br>
<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br>