[postgis-users] ST_MakePolygon to represent a square

Paragon Corporation lr at pcorp.us
Sun Apr 18 13:23:22 PDT 2010


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: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Aurélien
....
Sent: Saturday, April 17, 2010 7:53 AM
To: postgis-users at postgis.refractions.net
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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100418/7c88f507/attachment.html>


More information about the postgis-users mailing list