[gdal-dev] Using ogr2ogr to convert from csv - drops text after number
John D. Muccigrosso
john at muccigrosso.org
Wed Oct 25 12:07:18 PDT 2017
I'm using ogr2ogr to convert an xml file (from Google sheets) to csv.
All is well except when there's a value like
1 two
then the conversion will clip throw out everything after the "1". I take
it that it sees a number and stops there.
I've got a workaround, but is there any way to tell ogr2ogr to treat the
entire value?
Here's a simple xml file that exhibits the behavior:
```
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
xmlns:gsx='http://schemas.google.com/spreadsheets/2006/extended'>
<entry>
<id>one</id>
<updated>2017-10-24T19:42:20.580Z</updated>
<title type='text'>1000001</title>
<dummy>One_word</dummy>
<dummy2>One, two</dummy2>
<dummy3>One two</dummy3>
<dummy4>1, two</dummy4>
<dummy5>one, 2</dummy5>
<dummy6>1 two</dummy6>
<dummy7>one 2</dummy7>
</entry>
</feed>
```
ogr2ogr -f csv output.csv input.xml yields:
```
id,updated,title,title_type,dummy,dummy2,dummy3,dummy4,dummy5,dummy6,dummy7
one,2017/10/24 19:42:20.580+00,1000001,text,One_word,"One, two",One
two,"1, two","one, 2",1,one 2
```
That second-to-last value should be "1 two" (with the quotes).
TIA.
John
More information about the gdal-dev
mailing list