[postgis-users] Write out KML for each database record?

Guido Lemoine guido.lemoine at jrc.it
Wed Oct 24 00:12:00 PDT 2007


Dane,

Why not drop PHP and learn Java instead? You can combine JDBC access to
your data base (simply looping through your resultset, which can have 
askml() as
one of the columns) with Java's XML document processing (JDOM) to do
all you want to do.

GL

Dane Blakely Springmeyer wrote:
> 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
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

-- 
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Unit: Support to External Security
Via E. Fermi, 1 TP 267 Ispra 21020 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Disclaimer:
Views expressed are those of the individual and do not represent 
the views of the European Commission





More information about the postgis-users mailing list