<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19393"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>Hello,</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>I'm not sure to understand everything about what you 
are trying to do, but if i'm not wrong, you try to rasterize some 
geometries. I'm not sure that's the better way to work, but i don't really know 
how your data looks like.</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>Anyaway, it seems to me you're misunderstanding about 
rasters and bands. The first one is a regular grid of pixels, and the second is 
a kind of layer. For example, a RGB image is a three bands 
raster.</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>As far as i understand your problem, it seems to me 
that you need only a one raster band where you should add all your points' 
values with st_MakeEmptyRaster (setting properly the origin - upperleft corner X 
and Y- , extent and pixel size to match your points spatial distribution), 
then add a band and finally you should be able to set pixels values using 
st_SetValue with st_MakePoint to make a geometry from your long/lat 
coordinates.</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>If you want to use spatial index on raster, it should 
be better to tile it first with st_Tile (available since postgis 
2.1)</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><SPAN 
class=654561915-28012013>Hugues.</SPAN></SPAN></DIV>
<DIV> </DIV><BR>
<DIV dir=ltr lang=fr class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> postgis-users-bounces@lists.osgeo.org 
[mailto:postgis-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Mikel 
Gonzalez<BR><B>Sent:</B> Monday, January 28, 2013 3:35 PM<BR><B>To:</B> 
postgis-users@lists.osgeo.org<BR><B>Subject:</B> [postgis-users] PostGIS Raster 
and Overviews<BR></FONT><BR></DIV>
<DIV></DIV>Hi all!<BR><BR>I'm quite new to PostGIS but I think I'm learning 
rather quickly. Anyways, I have a question regarding the storage of raster data 
in PostGIS. First of all, I think the raster2psql utility is wondrous and works 
great but unfortunately some of the data I need to store as a raster comes to me 
in text format. Let's say I have the latitude/longitude values and then the 
value of the raster in that point which in this case, it'll be the 
swell.<BR><BR>Thing is I've been loading this data to postGIS without any major 
complication and then publishing that same info through geoserver. Let me show 
you how I load the data to PostGIS:<BR><BR>First,<BR>
<BLOCKQUOTE><SMALL>create table <tableName> (rid SERIAL primary key, 
  rast raster)</SMALL><BR><BR></BLOCKQUOTE>Then, for every row of data, 
<BR>   <BR>
<BLOCKQUOTE><SMALL>insert into <tableName> (rast) select 
  ST_AddBand(ST_MakeEmptyRaster(1,1,<long>, <lat>,1,1,0,0,4326), 1, 
  '32BF', %s, 0.0)</SMALL><BR></BLOCKQUOTE><BIG>And,<BR></BIG>
<BLOCKQUOTE><SMALL>CREATE INDEX myrasters_rast_st_convexhull_idx ON 
  <tableName> USING gist( ST_ConvexHull(rast) );</SMALL><BR><SMALL>SELECT 
  AddRasterConstraints('<tableName>'::name, 
'rast'::name);</SMALL><BR></BLOCKQUOTE><BR>This is all done in a python script 
and stores the data (I think) correctly. I've got to admit that I still need to 
understand a little bit more some of the parameters that are passed to the 
AddBand and MakeEmptyRaster functions, but I can do it in my own, this is not 
why I'm writing to you. The reason in fact, is that even though GeoServer does 
show the data, it takes quite a lot to load, and I thought it might be because I 
have not defined any overviews. I've been trying to find how to do it, but all I 
see is references to the raster2psql utility, but since I'm also a little new 
with Python I don't know exactly what it does.<BR><BR>So, after all this, my 
question would be how can I add overviews "manually" to this raster data I'm 
loading? I would even appreciate if you can tell me where in raster2psql.py I 
can find it, or if it is in any other file it's being used for that 
purpose.<BR><BR>Thank you very much for reading and I hope I was clear enough 
about my issue :-)<BR><BR><PRE class=moz-signature cols="72">-- 
--

Mikel Gonzalez Gainza,
Informatikari bekaduna CENER-en // Becario informático en CENER
<A class=moz-txt-link-abbreviated href="http://www.cener.com">www.cener.com</A></PRE></BODY></HTML>