<!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.7600.16625"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>Andreas,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>ST_SetSRID requires an SRID as the second
argument.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>e.g.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>ST_SetSRID(geom, 4326)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>I'm assuming that is what you are missing.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial>Leo</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=492103421-20082010><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=492103421-20082010></SPAN><FONT face=Arial><FONT
color=#0000ff><FONT size=2><A
href="http://www.postgis.us">http://www.postgis.us</A></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=492103421-20082010></SPAN></FONT></FONT></FONT><FONT color=#0000ff size=2
face=Arial></FONT><BR> </DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Andreas Forø Tollefsen<BR><B>Sent:</B> Friday, August 20, 2010 5:22
PM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B>
[postgis-users] Vector Grid / Fishnet - ST_MakeEnvelope<BR></FONT><BR></DIV>
<DIV></DIV>Hi all.
<DIV><BR></DIV>
<DIV>I am currently developing a global vector grid from a set of centroid
points.</DIV>
<DIV>My data includes a csv file defining the x and y coordinate of each
point.</DIV>
<DIV>These points are imported into a table. I then add a point geometry field
and apply the ST_MakePoint function to create the point features.</DIV>
<DIV>All well. However, the next step is to create a bounding box for each of
the points. </DIV>
<DIV>In other words, I want a vector cell of 0.5 decimal degrees surrounding
each point. I have tried using the ST_MakeEnvelope function as this allows me to
use the x and y coordinate, and subtract and add 0.25 to the centroid x and y
value.</DIV>
<DIV>However, I have not been able to use the ST_MakeEnvelope as i receive an
error.</DIV>
<DIV>I cannot figure out what i am doing wrong.</DIV>
<DIV><BR></DIV>
<DIV>I have attached my sql below. Thanks for any help i might get.</DIV>
<DIV>
<DIV>-- CREATE TABLE points(</DIV>
<DIV>-- id int,</DIV>
<DIV>-- xcoord float,</DIV>
<DIV>-- ycoord float)</DIV>
<DIV><BR></DIV>
<DIV>-- COPY points(ID,XCOORD,YCOORD)</DIV>
<DIV>-- FROM 'c:/postgis/pgpt.csv/pgpt.csv'</DIV>
<DIV>-- WITH DELIMITER AS ','</DIV>
<DIV>-- CSV HEADER;</DIV>
<DIV>-- </DIV>
<DIV>-- ALTER TABLE points ADD PRIMARY KEY (id)</DIV>
<DIV><BR></DIV>
<DIV>-- SELECT AddGeometryColumn('public', 'points', 'centroid', 4326, 'POINT',
2);</DIV>
<DIV>-- </DIV>
<DIV><BR></DIV>
<DIV>-- UPDATE points SET centroid=ST_SetSRID(ST_MakePoint(xcoord, ycoord),
4326);</DIV>
<DIV>-- </DIV>
<DIV>-- SELECT AddGeometryColumn('public', 'points', 'cell', 4326, 'POLYGON',
2);</DIV>
<DIV>-- </DIV>
<DIV>-- UPDATE points SET
cell=ST_SetSRID(ST_MakeEnvelope(xcoord-0.25,ycoord-0.25,xcoord+0.25,ycoord+0.25,
4326));</DIV>
<DIV>-- </DIV></DIV>
<DIV>This last line give me:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>ERROR: function st_setsrid(geometry) does not exist</DIV>
<DIV>LINE 20: UPDATE points SET
cell=ST_SetSRID(ST_MakeEnvelope(xcoord-0.2...</DIV>
<DIV>
^</DIV>
<DIV>HINT: No function matches the given name and argument types. You
might need to add explicit type casts.</DIV>
<DIV><BR></DIV>
<DIV>********** Error **********</DIV>
<DIV><BR></DIV>
<DIV>ERROR: function st_setsrid(geometry) does not exist</DIV>
<DIV>SQL state: 42883</DIV>
<DIV>Hint: No function matches the given name and argument types. You might need
to add explicit type casts.</DIV>
<DIV>Character: 501</DIV></DIV></BODY></HTML>