Hi Nicolas and Paolo,<br><br>This is what I have been able to come up with:<br><br><blockquote><span class="sewgx3k4d7gjofi"></span>DROP EXTENSION postgis;<br>CREATE EXTENSION postgis;<br><br>DROP TABLE IF EXISTS stops;<br>
<br>CREATE TABLE stops<br>(<br> stopid bigint NOT NULL,<br> stopidentifier bigint,<br> description text,<br> street text,<br> municipality text,<br> parentmunicipality text,<br> lat double precision,<br> lon double precision,<br>
stopisaccessible boolean,<br> stopispublic boolean,<br> PRIMARY KEY (stopid)<br>)<br>WITH (<br> OIDS=FALSE<br>);<br>ALTER TABLE stops<br> OWNER TO postgres;<br><br>CREATE OR REPLACE FUNCTION addwgs84() RETURNS trigger AS<br>
$body$<br> DECLARE<br> node geometry;<br> BEGIN<br> node := st_transform(st_setSRID(st_makePoint(NEW.lat, NEW.lon), 31370),4326);<br> NEW.lat := st_x(node);<br> NEW.lon := st_y(node); <br> RETURN NEW;<br>
END;<br> $body$<br> LANGUAGE 'plpgsql';<br><br>CREATE TRIGGER wgs84<br> AFTER INSERT OR UPDATE ON stops<br> FOR EACH ROW EXECUTE PROCEDURE addwgs84();<br><br>COPY stops FROM 'C:/stops.csv' DELIMITERS ';' CSV HEADER;<span class="sewgx3k4d7gjofi"></span><br>
</blockquote><br><span class="sewgx3k4d7gjofi"></span><span class="sewgx3k4d7gjofi">Unfortunately, this doesn't result in WGS84 lat and lon, but gives me lambert72 once again. I must be missing something crucial somewhere. I don't need the geometry in the table, so I took it out again. I'm not going to use it to calculate distances. This is only an intermediate step in converting all of it to an XML-format suitable for Openstreetmap.org.<br>
<br>Thanks for your help. Hopefully I'm near to the goal I wanted to reach, now and you can nudge me a bit further in the right direction.<br><br>Jo<br></span><div class="gmail_extra"><br><br><div class="gmail_quote">
2012/11/13 Nicolas Ribot <span dir="ltr"><<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>Use the COPY command to load CSV to a table.<br><br></div><div>The rest depends if you want to display/use the geometry, or you're only interested in the coordinates:</div><div>• Add a geometry column</div>
<div>• st_makePoint to build a point from coordinates</div><div>• A trigger to create the WGS84 point from coordinates with st_transform: st_transform(st_setSRID(st_makePoint(<span style="font-family:arial,sans-serif;font-size:13px">coordinateX, </span><span style="font-family:arial,sans-serif;font-size:13px">coordinateY), 31300), 4326)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Nicolas</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">
<div><div class="h5">
On 13 November 2012 13:54, Jo <span dir="ltr"><<a href="mailto:winfixit@gmail.com" target="_blank">winfixit@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
Hi,<br>
<br>
I've been reading docs, but I'm afraid I can't figure it out on my own.<br>
<br>
I have a csv-file:<br>
POI_ID;POI_name;coordinateX;coordinateY<br>
<br>
<br>
Where X and Y are in Lambert72.<br>
<br>
<br>
How can I get these in a table that includes 2 columns with those same<br>
coordinates in WGS84? Should I have a column with a geometry type and<br>
a point in it? Can I create a trigger function which updates the WGS84<br>
as the Lambert72 are inserted?<br>
</div></div><span><font color="#888888"><br>
Jo<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</font></span></blockquote></div><br></div>
</blockquote></div><br></div>