[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Vector Grid / Fishnet - ST_MakeEnvelope
From:       "Paragon Corporation" <lr () pcorp ! us>
Date:       2010-08-20 21:35:47
Message-ID: BBC2A7B51F0848A3BF925E5A4E503C80 () J
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Andreas,
ST_SetSRID requires an SRID as the second argument.
 
e.g.
 
ST_SetSRID(geom, 4326)
 
I'm assuming that is what you are missing.
 
Leo
 
http://www.postgis.us

 
  _____  

From: postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of Andreas
Forø Tollefsen
Sent: Friday, August 20, 2010 5:22 PM
To: postgis-users@postgis.refractions.net
Subject: [postgis-users] Vector Grid / Fishnet - ST_MakeEnvelope


Hi all. 

I am currently developing a global vector grid from a set of centroid
points.
My data includes a csv file defining the x and y coordinate of each point.
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.
All well. However, the next step is to create a bounding box for each of the
points. 
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.
However, I have not been able to use the ST_MakeEnvelope as i receive an
error.
I cannot figure out what i am doing wrong.

I have attached my sql below. Thanks for any help i might get.
-- CREATE TABLE points(
-- id int,
-- xcoord float,
-- ycoord float)

-- COPY points(ID,XCOORD,YCOORD)
-- FROM 'c:/postgis/pgpt.csv/pgpt.csv'
-- WITH DELIMITER AS ','
-- CSV HEADER;
-- 
-- ALTER TABLE points ADD PRIMARY KEY (id)

-- SELECT AddGeometryColumn('public', 'points', 'centroid', 4326, 'POINT',
2);
-- 

-- UPDATE points SET centroid=ST_SetSRID(ST_MakePoint(xcoord, ycoord),
4326);
-- 
-- SELECT AddGeometryColumn('public', 'points', 'cell', 4326, 'POLYGON', 2);
-- 
-- UPDATE points SET
cell=ST_SetSRID(ST_MakeEnvelope(xcoord-0.25,ycoord-0.25,xcoord+0.25,ycoord+0
.25, 4326));
-- 
This last line give me:

ERROR:  function st_setsrid(geometry) does not exist
LINE 20: UPDATE points SET cell=ST_SetSRID(ST_MakeEnvelope(xcoord-0.2...
                                ^
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.

********** Error **********

ERROR: function st_setsrid(geometry) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need
to add explicit type casts.
Character: 501

[Attachment #5 (text/html)]

<!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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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.&nbsp;</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>--&nbsp;</DIV>
<DIV>-- ALTER TABLE points ADD PRIMARY KEY (id)</DIV>
<DIV><BR></DIV>
<DIV>-- SELECT AddGeometryColumn('public', 'points', 'centroid', 4326, 'POINT', 
2);</DIV>
<DIV>--&nbsp;</DIV>
<DIV><BR></DIV>
<DIV>-- UPDATE points SET centroid=ST_SetSRID(ST_MakePoint(xcoord, ycoord), 
4326);</DIV>
<DIV>--&nbsp;</DIV>
<DIV>-- SELECT AddGeometryColumn('public', 'points', 'cell', 4326, 'POLYGON', 
2);</DIV>
<DIV>--&nbsp;</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>--&nbsp;</DIV></DIV>
<DIV>This last line give me:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>ERROR: &nbsp;function st_setsrid(geometry) does not exist</DIV>
<DIV>LINE 20: UPDATE points SET 
cell=ST_SetSRID(ST_MakeEnvelope(xcoord-0.2...</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</DIV>
<DIV>HINT: &nbsp;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>


_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic