[postgis-users] Vector Grid / Fishnet - ST_MakeEnvelope
Paragon Corporation
lr at pcorp.us
Fri Aug 20 14:35:47 PDT 2010
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 at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Andreas
Forø Tollefsen
Sent: Friday, August 20, 2010 5:22 PM
To: postgis-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100820/c902e544/attachment.html>
More information about the postgis-users
mailing list