I have a CSV file "visivisi.csv" with two columns "x,y" which is in my country local projection. The proj4 line is
+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
I am trying to use ogr2ogr to convert this CSV to a new CSV file in wgs84 projection, is this even possible? This doesn't work:
ogr2ogr -f csv -s_srs "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" -t_srs "EPSG:4326" test.csv visivisi.csv
EDIT: Thanks to below answer, this is the solution (too long for comment section):
if you have a csv file with fields "x,y" called "visivisi.csv", make such visivisi.vrt file:
<OGRVRTDataSource>
<OGRVRTLayer name="visivisi">
<SrcDataSource>visivisi.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs</LayerSRS>
<GeometryField encoding="PointFromColumns" x="x" y="y"/>
<Field name="latitude" src="x" />
<Field name="longitude" src="y" />
</OGRVRTLayer>
</OGRVRTDataSource>
Then run this command:
ogr2ogr -overwrite -f CSV -lco GEOMETRY=AS_XY -t_srs EPSG:4326 test.csv visivisi.vrt
test.csv can not exist beforehand. the SRS in the above example is latvian LKS92