[postgis-users] Re: Extent Generation
Leonardo Mateo
leonardomateo at gmail.com
Mon Jan 22 07:24:20 PST 2007
On 1/22/07, Leonardo Mateo <leonardomateo at gmail.com> wrote:
> Hi guys, I'm pretty new with all this GIS thing. I'm gonna need some help.
> I need to generate map files dynamically for different spatial
> datasets (mostly points) and I don't know how to find out the extent
> for each one of these data sets.
>
> For testing, I've been doing this with the help of external tools such
> as Quantum Gis or Udig but now I need to do this inside the
> application wich will be a PHP web application.
>
> How can I do it?
Nevermind guys, I've been digging in QGis source code and I found sql sentences.
It's so simple, sorry for such stupid question, I leave the answer
here just in case some other newbie need it.
[CODE]
//Returns a BOX object;
QString sql = "select extent(" + geometryColumn + ") from " + tableName;
//returns corners
sql = "select xmax(extent(" + geometryColumn + ")) as xmax,"
"xmin(extent(" + geometryColumn + ")) as xmin,"
"ymax(extent(" + geometryColumn + ")) as ymax," "ymin(extent(" +
geometryColumn + ")) as ymin" " from " + tableName;
[/CODE]
Cheers.
--
Leonardo Mateo.
There's no place like ~
More information about the postgis-users
mailing list