[gdal-dev] Ogr2ogr CSV driver not handling correctly line breaks inside columns

Moises Calzado mcalzado at carto.com
Mon Apr 24 04:34:04 PDT 2023


Hello!

We're trying to convert a Shapefile into a CSV using ogr2ogr and we're
having some issues while dealing with some columns that contain line breaks
inside their values. If we have a line with the following string, ogr2ogr
detects that the line break is a new line and it returns two lines.

"this is my \n value"


That's the command that we're executing:

ogr2ogr -f CSV -skipfailures -makevalid /vsistdout/ /vsizip/shapefile.zip
> -simplify 0.00001 -dim XY -t_srs EPSG:4326 -lco GEOMETRY=AS_WKT -lco
> GEOMETRY_NAME=geom -lco CREATE_CSVT=YES > result.csv
>

Is this an expected behaviour, or is there any way to avoid this?
Sharing an example Shapefile so that you can try to reproduce that
behaviour:
https://drive.google.com/file/d/1gFqfTP02KTFoavJyyO-Ix05YwZB2tS24/view?usp=sharing

Thanks so much in advance,
Regards.

-- 
*Moises Calzado*

Support Engineer

+34671264286 | mcalzado at carto.com | CARTO <https://www.carto.com/>
<https://spatial-data-science-conference.com/2023/london/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230424/8ff09db5/attachment.htm>


More information about the gdal-dev mailing list