[postgis-users] Getting the bounding box of a feature
Stephen Woodbridge
woodbri at swoodbridge.com
Wed Mar 30 13:44:55 PST 2005
Kurt,
Change you query to:
$extent_sql = "SELECT AsText(EXTENT(public.nmranch04.the_geom)) FROM
public.nmranch04 WHERE (public.nmranch04.ranch_name = ".$ranch.")";
An then you will have to parse the text.
-Steve W.
Menke, Kurt wrote:
> Hello,
>
> I’m developing a client in using PHP 4.3.4, Mapserver 4.4.1, and PostGIS
> 1.0.0 (PostgreSQL 7.4.1).
>
>
>
> I need to programmatically access the bounding box of a selected polygon
> in a PostGIS feature class so that I can use Mapscript to zoom to it.
> I’ve tested the SQL below in PostgreSQL and it returns: BOX3D(560748.25
> 3881950 0,568816.25 3890818.75 0). However, when I try to dump the
> results into a PHP variable I can’t seem to access the results. When I
> try to echo the results out to the page I get “Resource ID #68.
>
>
>
> I’m not familiar with the BOX3D format. Is there any info on BOX3D out
> there? Does this get returned as a string or an array or something
> else? If there’s a better way to do this I would very much appreciate
> that info as well.
>
>
>
> $extent_sql = "SELECT EXTENT(public.nmranch04.the_geom)FROM
> public.nmranch04 WHERE (public.nmranch04.ranch_name = ".$ranch.")";
>
>
>
> Thanks
>
> Kurt
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Kurt A. Menke
>
> GIS Analyst/Programmer
>
>
>
> _Mailing Address ___
>
> Earth Data Analysis Center
>
> MSC01 1110
>
> 1 University of New Mexico
>
> Albuquerque, New Mexico 87131-0001
>
>
>
> _Street Address___
>
> University of New Mexico
>
> Bandelier West, Room 123
>
> Albuquerque, NM 87131
>
>
>
> Phone: (505) 277-3622 (ext. 239)
>
> FAX: (505) 277-3614
>
> email: kmenke at edac.unm.edu
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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