[postgis-users] Documentation on GIS specific SQL

Matt Lynch matt at terraEngine.com
Thu Feb 20 09:36:50 PST 2003


Hi,

I have been working through the online documentation at
http://postgis.refractions.net/docs/ and was wondering if there are any
other sources of information.  That documentation and the listserv
archives have been very helpful so far, but I seem to be hitting
problems that are not covered now.

I am specifically interested in syntax examples of using opertations
such as centriod(), extent() listed in the appendixes and don't want to
waste the lists time with every newbie question I have. 

For example, currently I wish to return the extent/bbox of each row
returned in a query.

I currently do (in VB):
        strSQL = "SELECT *, npoints(the_geom), nrings(the_geom) FROM " &
name & " WHERE the_geom && GeometryFromText('BOX3D(" & ulx & " " & uly &
"," & lrx & " " & lry & ")'::box3d,-1);"

And I would like to do something like:

        strSQL = "SELECT *, extent(the_geom), npoints(the_geom),
nrings(the_geom) FROM " & name & " WHERE the_geom &&
GeometryFromText('BOX3D(" & ulx & " " & uly & "," & lrx & " " & lry &
")'::box3d,-1);"

But it appears that I must group in order to use extent

e.g. 

SELECT extent(the_geom)
 FROM demolakes GROUP BY gid;

and

SELECT xmin(extent(the_geom)) AS ulx, ymax(extent(the_geom)) AS uly
 FROM demolakes GROUP BY gid;

are valid, but ...

SELECT *,extent(the_geom)
 FROM demolakes GROUP BY gid;

Is not (grouping error on one of my dbf fields)

Thanks,

Matt

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.455 / Virus Database: 255 - Release Date: 2/13/2003
 





More information about the postgis-users mailing list