5

I am trying to convert a CSV with fields in one projection system (EPSG:27700) to fields in another (EPSG:4326).

I have made a VRT file called landfill.vrt, in the same directory as my CSV file, landfill.csv:

<OGRVRTDataSource>
  <OGRVRTLayer name="landfill">
    <SrcDataSource>/Users/me/Downloads/landfill.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
    <LayerSRS>EPSG:27700</LayerSRS>
    <GeometryField encoding="PointFromColumns" x="ctroid_x" y="ctroid_y"/>
  </OGRVRTLayer>
</OGRVRTDataSource>

ogrinfo seems to think it's OK:

$ ogrinfo -ro -al landfill.vrt
... 
OGRFeature(landfill):2010
  ctroid_x (String) = 567600
  ctroid_y (String) = 314500
  region (String) = Anglian
  area (String) = Central
  date_issue (String) = 21/10/10
  POINT (567600 314500)

But when I run ogr2ogr:

 $ ogr2ogr -s_srs EPSG:27700 -t_srs EPSG:4326 
  -f CSV -lco "GEOMETRY=AS_WKT" ./output/output.csv landfill.csv

it runs cleanly, but just outputs a copy of the original file to output/output.csv, without any new fields. What am I doing wrong?

  • 7
    What you really want to do is to convert landfill.vrt into output.csv. – user30184 Jan 20 '15 at 16:14
  • Yes! Thank you :) if you want to submit that as an answer, please do... – Richard Jan 20 '15 at 16:20
  • Does not feel much like an answer. You would have noticed it by yourself after having a break. – user30184 Jan 20 '15 at 16:26
  • It still might help future users who find this question, and it would take it out of the unanswered queue. – dericke Jan 23 '15 at 21:42
1

Answered by user30184 in comments section:

What you really want to do is to convert landfill.vrt into output.csv.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.