Hi Nicolas,

That's perfect, just what I needed.

Thanks very much.

Regards,

Richard.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Nicolas Ribot
Sent: 06 June 2011 11:27
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Mapping from x max, ymax, xmin, ymin

> Hi,
>
> I have a table with 4 columns, x max, ymax, xmin, ymin coordinates for
> the corner points of rectangles.
>
> Is there a way / function to convert these into a rectangle / polygon?
>
> Thanks,
>
> R.
>

Hi Franck,

Sure:

select st_makeBox2d(
   st_makepoint(xmin, ymin),
   st_makepoint(xmax, ymax))

will give you a BOX2D, ie a rectangle
the same query, cast as a geometry, will convert it to a POLYGON (5
coordinates):

select astext(st_makeBox2d(
   st_makepoint(0, 1),
   st_makepoint(2, 3))::geometry)

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

Infoterra Ltd. Is part of the Astrium GEO-Information Services Division and a 
wholly owned subsidiary of Astrium, Europe's leading space systems and services 
specialist.

Disclaimer. The information contained in this e-mail and its attachments are 
confidential and intended only for the use of the named addressee(s). If you 
are not the intended addressee, please do not read, copy, use or disclose this 
message or its attachments. If you have received this message in error, please 
notify the sender immediately and delete or destroy all copies of this message 
and attachments in all media. Any views or opinions expressed are solely those 
of the author and do not necessarily represent those of Infoterra Ltd and shall 
not form part of any binding agreement.

Infoterra Limited a company registered in England under number 2359955 and 
having its registered office at Atlas House, 41 Wembley Road, Leicester, LE3 
1UT. VAT number GB 476 0468 27. 

P Before printing, think about the environment 

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

Reply via email to