[postgis-users] create xml file from sql table

Josh Preston Josh.Preston at rpdata.com
Tue Oct 19 04:54:11 PDT 2010


Hi,

 

You can use psql to run your query from the command line.

 

psql -At -U {username} -c "select
table_to_xml('building3',true,true,'');" {database} > query.xml

 

-A unaligned output (no formatting of results for display purposes)

-t Rows only (ie no header, so your xml file to only has xml in it)

 

If you don't really need an automated way you can use the "Execute query
to file" option in pgAdmin.

 

Regards,

 

Josh

 

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
zhang zhe
Sent: Tuesday, 19 October 2010 9:37 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] create xml file from sql table

 

Hello,
 
Does anyone knows how to generate xml file from postgres table. 

select table_to_xml('building3',true,true,'');

will print xml file in data output . How can I generate a file, and save
it to directory automatically. I want to write this function in php
code. 

 

Thank you very much. 

 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101019/c3da0e87/attachment.html>


More information about the postgis-users mailing list