All,

I have a test file that contains the data to the loaded to the spatial table I have. The table structure is <lat,lon,data1,data2,spatialPoint>. Sample data in the txt file : <-64.7647, -56.57647, 1234548, 1221312>.

So I want to load the table from this text file. I use the COPY query below.

*COPY "table_name" (lat,lon,data1,data2) FROM 'FILE' DELIMITER ','*

But the problem is I am not able to update the spatialPoint using copy query. So for now I am loading the lat,lon,data1,data2 fields and then update the spatialPoint using a separate query similar to one below:

*UPDATE "table_name" SET "spatialPoint" = ST_SetSRID(ST_MakePoint(lat,lon),4326) WHERE "spatialPoint" IS NULL*

My question is, is there a way to avoid the second query so that I can also load the spatialPoint in the COPY query?

Also I initial dint want to have lat,lon in the table and have only the spatialPoint field. Because of the above problem I was forced to have lat,lon fields in the table. Someway to achieve this will help me a lot.


Thanks,
Sairam Krishnamurthy
+1 612 859 8161

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

Reply via email to