Aurélien,
 
Probably easier to use ST_MakeEnvelope to make a 4 sided polygon.  Also
remember x is long and y is lat
 
http://www.postgis.org/documentation/manual-1.5/ST_MakeEnvelope.html
 
 
INSERT INTO geo_countries (id, box)
    SELECT id, geography(ST_MakeEnvelope(min_longi, min_lati, max_longi,
max_lati,4326))
 FROM countries;
 
 
Leo and Regina,
http://www.postgis.us
 

 
  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Aurélien
....
Sent: Saturday, April 17, 2010 7:53 AM
To: [email protected]
Subject: [postgis-users] ST_MakePolygon to represent a square


Hello everybody,

I'm new on Postgis and I need help to create / fill a table.

I have to make a column which represent a square (min_lati, min_longi,
max_lati, max_longi). I've done this :

CREATE TABLE geo_countries (
        id bigint PRIMARY KEY,
        box geography(POLYGON,4326));

INSERT INTO geo_countries (id, box)
    SELECT id, ST_MakePolygon(??) FROM countries;

Is the POLYGON type is correct to make this ?

The "countries" table have the fields min/max lati/longi, but I don't know
how to make a polygon with SQL command...

Can you help me ?

Thank you very much,

Aurélien


_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to