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>