Hi Leonardo. I think that maybe if you want to get the extent of a entire Postgis table you may use the Postgis function: <br><br><span>estimated_extent([schema], table, geocolumn)<br><br>You can read the documentation at section "
6.2.8 Misc" on Postgis docs page:<br><br><a href="http://postgis.refractions.net/docs/ch06.html#id2840629" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://postgis.refractions.net/docs/ch06.html#id2840629
</a><br><br>I
think it must be faster cause it is based on the statistics generated
by Postgres at Vacuum process. The documentation says that for Postgres
>=
8.0.0 the </span>resulting extent will be about 95% of the real one.
With your solution the extent may be more accurated but for large
datasets could be slower I guess. Maybe someone in the list with
advanced knowledge on Postgres/Postgis can tell us if this method
really improves considerably the response time.
<br><br><div><span class="gmail_quote">On 1/22/07, <b class="gmail_sendername">Humberto Cereser Ibanez</b> <<a href="mailto:humberto@pastoraldacrianca.org.br">humberto@pastoraldacrianca.org.br</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
De: "Leonardo Mateo" <<a href="mailto:leonardomateo@gmail.com">leonardomateo@gmail.com</a>><br>Data: Mon, 22 Jan 2007 11:58:14 -0300<br>Para: <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net
</a><br>Assunto: [postgis-users] Extent Generation<br><br>Hi guys, I'm pretty new with all this GIS thing. I'm gonna need some help.<br>I need to generate map files dynamically for different spatial<br>datasets (mostly points) and I don't know how to find out the extent
<br>for each one of these data sets.<br><br>For testing, I've been doing this with the help of external tools such<br>as Quantum Gis or Udig but now I need to do this inside the<br>application wich will be a PHP web application.
<br><br>How can I do it?<br><br>Thanx a lot in advance.<br><br>--<br>Leonardo Mateo.<br><br>Mateo,<br><br>in my application I write the following code in PHP:<br><br><?<br>function calcula_extent($base, $tabela_shp, $tabela_setor)
<br>{<br> $extent = array();<br> $conexao = pg_connect("host=localhost dbname=$base user=postgres");<br> $result_sql = pg_query<br>                ($conexao,<br>                        "select<br>                                xmin(extent(the_geom)),
<br>                                ymin(extent(the_geom)),<br>                                xmax(extent(the_geom)),<br>                                ymax(extent(the_geom))<br>                        from $tabela_shp where id_ in (select * from $tabela_setor);" // tabela_shp and tabela_setor has the id_ column as the identifier.
<br>                );<br> $extent[0] = pg_result($result_sql, 0, 0);<br> $extent[1] = pg_result($result_sql, 0, 1);<br> $extent[2] = pg_result($result_sql, 0, 2);<br> $extent[3] = pg_result($result_sql, 0, 3);<br> return $extent;
<br>}<br>?><br><br>$extensao = calcula_extent($base, "brasil", $nome_tabela_setor);<br><br>I hope this code help you,<br><br>Humberto Cereser Ibanez<br>Pastoral da Criança<br>Curitiba - PR<br>_______________________________________________
<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users
</a><br></blockquote></div><br>