[postgis-users] Mapserver extent question

Stephen Woodbridge woodbri at swoodbridge.com
Tue Sep 20 14:23:13 PDT 2005


Hello David,

David Niergarth wrote:
> Hello,
> 
> I have an extent from mapserver (e.g., "-121.682485 38.408966 
> -121.231440 38.763359") that I want to feed back into a PostGIS query.

these values are (xmin ymin xmax ymax)

> How do I express this extent in my query?
> 
> I want to write a query something like

for this && selects all the_geom that has a bbox the overlaps with <what 
goes here> so you can create a line from xmin,ymin to xmax,ymax and it 
will have the bbox you want for the comparison

MakeLine(MakePoint(xmin, ymin), MakePoint(xmax, ymax))

> select recid from tbl_points
> where the_geom && <what goes here?> ;
> 
> 
> A related question... What's a BOX (see following query):

This is the bbox of the extents of all the the_geom objects returned by 
your query. you can access the fields of the BOX() maybe? with

xmin(), ymin(), xmax(), and ymax() functions

-Steve Woodbridge

> select extent(the_geom) from tbl_points ;
>                                    extent
> ---------------------------------------------------------------------------- 
> 
>  BOX(-124.278755187988 32.5427703857422,-73.5306396484375 46.1519355773926)
> (1 row)
> 
> It doesn't appear to be a WKT format. Is there a way to use BOX like you 
> would with other WKT formats?
> 
> Thanks for any suggestions.
> 
> --David
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list