Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active September 30, 2016 16:15
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbostock/35c319a7e790cc2cf987 to your computer and use it in GitHub Desktop.
Save mbostock/35c319a7e790cc2cf987 to your computer and use it in GitHub Desktop.
Reprojecting CSV with ogr2ogr
license: gpl-3.0
rm -f output.csv
ogr2ogr -f CSV -t_srs EPSG:4326 -lco GEOMETRY=AS_XY -nln output output.csv input.vrt
X Y
995504 189189
998641 236979
1009146 209683
997374 234664
999539 239499
1007700 180317
1035328 160816
1047047 207400
<OGRVRTDataSource>
<OGRVRTLayer name="input">
<SrcDataSource relativeToVRT="1">input.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>EPSG:2263</LayerSRS>
<GeometryField encoding="PointFromColumns" x="X" y="Y" reportSrcColumn="FALSE"/>
</OGRVRTLayer>
</OGRVRTDataSource>
X Y
-73.959421539551499 40.68594967800022
-73.948008210235358 40.817116544476939
-73.910156921484216 40.742172925537574
-73.952590152183006 40.81076448996351
-73.944758176154096 40.82403172341445
-73.915477404082822 40.661574133668388
-73.816043551126768 40.607931877025436
-73.773403975999372 40.735718766524542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment