Use a database cursor and loop through the records you want. See http://www.postgresql.org/docs/8.0/interactive/plpgsql-cursors.html.
Martin Chapman Chief Software Architect Fortified Datacom Inc. http://www.fortifieddatacom.com [EMAIL PROTECTED] 303-324-1065 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dane Blakely Springmeyer Sent: Tuesday, October 23, 2007 4:37 PM To: PostGIS Users Discussion Subject: [postgis-users] Write out KML for each database record? Hello, I have been using the PostgreSQL COPY command and the Postgis AsKml() function to write out a KML file for a single database record that matches a WHERE clause, which is very handy. Here is the generalized SQL query: Copy (SELECT 'XML HEADER HERE' || askml(the_geom) || 'XML FOOTER HERE' from mytable where name = unique record) TO '/recordname.kml'; I would like to do this for every database record, therefore creating a single, independent KML file for every geometry row. I think this undoubtedly requires a bit of scripting to loop through every database record and save to a new .kml file by running an individual SQL query as many times are there are rows. I am learning PHP, but at this point turning query results into arrays and then passing those back to another query is beyond my skill level. Has anyone else used PHP, PL/PGSQL, or other approaches to try something like this? Dane _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
