[postgis-users] create xml file from sql table

2010-10-19 Thread zhang zhe

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. 
  ___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] create xml file from sql table

2010-10-19 Thread Josh Preston
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-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of
zhang zhe
Sent: Tuesday, 19 October 2010 9:37 PM
To: postgis-users@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 
__

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] create xml file from sql table

2010-10-19 Thread zhang zhe

Hello,
 
Thanks. Do you know how to run this in php. I am writting  php file which query 
from postgres and produce xml file. Do you know how to do it with php?
 
Thanks
 


Date: Tue, 19 Oct 2010 21:54:11 +1000
From: josh.pres...@rpdata.com
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] create xml file from sql table






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-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of zhang zhe
Sent: Tuesday, 19 October 2010 9:37 PM
To: postgis-users@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 
__
___ postgis-users mailing list 
postgis-users@postgis.refractions.net 
http://postgis.refractions.net/mailman/listinfo/postgis-users   
 ___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] create xml file from sql table

2010-10-19 Thread Josh Preston
I haven't used php myself, so I am not sure how you use it to talk to
postgres.

 

Josh

 

From: postgis-users-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of
zhang zhe
Sent: Tuesday, 19 October 2010 10:23 PM
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] create xml file from sql table

 

Hello,
 
Thanks. Do you know how to run this in php. I am writting  php file
which query from postgres and produce xml file. Do you know how to do it
with php?
 
Thanks
 



Date: Tue, 19 Oct 2010 21:54:11 +1000
From: josh.pres...@rpdata.com
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] create xml file from sql table

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-boun...@postgis.refractions.net
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of
zhang zhe
Sent: Tuesday, 19 October 2010 9:37 PM
To: postgis-users@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 
__


___ postgis-users mailing
list postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users 
__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] create xml file from sql table

2010-10-19 Thread zhang zhe

hello,
I tried your code

 
psql -At -U postgres -c “select table_to_xml(‘building3’,true,true,’’);” 
postgres  query.xml
 
but it gives erro
ident authentication failed for user postgres
 
what should be the user name. I tried with localhost, it gives the same error. 
 
Do you have any idea?
 
Thanks


Date: Tue, 19 Oct 2010 21:54:11 +1000
From: josh.pres...@rpdata.com
To: postgis-users@postgis.refractions.net
Subject: Re: [postgis-users] create xml file from sql table






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-boun...@postgis.refractions.net 
[mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of zhang zhe
Sent: Tuesday, 19 October 2010 9:37 PM
To: postgis-users@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 
__
___ postgis-users mailing list 
postgis-users@postgis.refractions.net 
http://postgis.refractions.net/mailman/listinfo/postgis-users   
 ___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] create xml file from sql table

2010-10-19 Thread Mike Toews
From a user's standpoint, PostgreSQL (and PostGIS) does not write files. In
order to read/write files, you need tools (psql, pgAdminIII, pgsql2shp,
etc.). You need to write a custom tool for your situation in PHP.

Ignoring details, you will need a database connection from PHP to
PostgreSQL, run your query, and put the text result into PHP. Once PHP has
this data, you can open a file in write mode and write the lines to the
file.

-Mike

On 19 October 2010 04:37, zhang zhe luckycl...@hotmail.com wrote:

  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.



 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users