Hi, The strings fields are created by default with width 80. If there are longer strings in the data the width is automatically extended up till 255 characters that is the maximum that dBase format supports. If strings are shorter than 80 charaters it is possible to use RESIZE and shrink the width to match the longest string used in that field.
If you need better control on field widths I suppose you must create an empty shapefile for ogr2ogr to append by your own code. # Add a new field. field_defn = ogr.FieldDefn('NEWFLD', ogr.OFTString) field_defn.SetWidth(12) Do you have some concrete problem with field widths that you want to resolve? -Jukka Rahkonen- -----Alkuperäinen viesti----- Lähettäjä: gdal-dev <gdal-dev-boun...@lists.osgeo.org> Puolesta matteo Lähetetty: perjantai 8. lokakuuta 2021 9.11 Vastaanottaja: Even Rouault <even.roua...@spatialys.com>; gdal-dev@lists.osgeo.org Aihe: Re: [gdal-dev] ogr2ogr changes field length Hi Even, > If you add -lco RESIZE=YES fields will be resized to their minimum size. > See > https://gdal.org/drivers/vector/shapefile.html#layer-creation-options yep I see. I also read * String fields without an assigned width are treated as 80 characters does it mean that if a field is set as TEXT in PG (without length definition) the conversion to shapefile is automatically set to 80 and what we can do is to resize the field length only to have less characters? Cheers! Matteo _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev