« Return to Thread: insert interactively asc or text files

Re: insert interactively asc or text files

by pere roca :: Rate this Message:

Reply to Author | View in Thread


  hi Michael,
  thanks for your references, the problem is that what I want is not to type anything in console (psql) but to construct an automatic insertion to Db (when the user uploads a "text" (.csv, .txt file) and send it to my server, then it runs "something" to insert into a table). Shortly, what I want is to let users see his point data (species occurences) in my web application; when session finishes, data should disappear. So, I should construct a script, maybe using COPY, but how to write such kind of scripts? some PDF, web references to learn it?

  I was thinking to restrict the data to insert (X,Y and species, genus, family) and to have a pre-constructed table in PostGIS with these columns. I suppose it should minimize much more the work and time to insert data and should also make much easier the scripting.
 

  Thanks.

Michael Fuhr wrote:
On Wed, Jul 04, 2007 at 12:53:27AM -0700, pere roca wrote:
>   I just was wondering if there is some tool to insert automatically data
> from a .asc or .csv or text file (just X,Y and thematic data) to PostGIS
> (something similar to shp2pgsql.exe).

Are you familiar with COPY (or psql's \copy)?

http://www.postgresql.org/docs/8.2/interactive/sql-copy.html
http://www.postgresql.org/docs/8.2/interactive/app-psql.html

>   What I want to do is that after a user inserts a file in our server,
> automatically this file is inserted in someway to PostGIS. How would you do
> it?

How are files being sent to the server?  Can you explain in more
detail how your system works and what you're trying to do?

--
Michael Fuhr
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

 « Return to Thread: insert interactively asc or text files