[gdal-dev] CSV to CSV?

William Kyngesburye woklist at kyngchaos.com
Wed Mar 12 13:41:02 PDT 2014


I can't get a direct CSV to CSV conversion to work.  Taking one of the NGA geoname country files, I created a csvt for field types and a vrt to assign the SRS.  This:

ogr2ogr -select "ufi,uni,cc1,adm1,dsg,full_name_ro" \
-where "fc = 'P' and (nt = 'N' or nt = 'D' or nt = 'P')" \
-f "CSV" -lco "GEOMETRY=AS_XY" -lco "SEPARATOR=TAB" -lco "CREATE_CSVT=YES" \
ca_pp.csv ca.vrt

tells me that "Layer ca already exists".  But that's the input layer/source!

It will convert to shapefile:

ogr2ogr -select "ufi,uni,cc1,adm1,dsg,full_name_ro" \
-where "fc = 'P' and (nt = 'N' or nt = 'D' or nt = 'P')" \
ca_pp ca.vrt

-> ca_pp/ca.shp

But I can't convert that to CSV, I get the same error "Layer ca already exists".

Converting to postgis, then extracting to CSV works (same select, where and lco options).

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"I ache, therefore I am.  Or in my case - I am, therefore I ache."

- Marvin




More information about the gdal-dev mailing list