Bug 5214: Shapefile to Shapefile- Conversion failed

Hi Alexander,

I moved to new version 26.5 and here my results:

Test data(input/output/QGIS)
shapefile8.7z (7.5 MB)

Error:

[ShapefileTest] Testing Shapefile → Shapefile

Args: input=‘D:\GisConverter\Tests\Shapefile\Input\shapefile8.7z’, format=‘Shapefile’, output=‘D:\GisConverter\Tests\Shapefile\Output\2026-06-04_18-00-48\ShapefileTest\Shapefile’, temp=‘D:\GisConverter\Tests\Shapefile\Temp\2026-06-04_18-00-48\ShapefileTest\Shapefile’, logPath=‘D:\GisConverter\Tests\Shapefile\Log\2026-06-04_18-00-48\shapefiletest_shapefile_log.txt’, logLevel=‘’
:x: Conversion failed.
2026-06-04T18:00:55.8626418+03:00 (Local) | 2026-06-04T15:00:55.8626418Z (UTC)
Unexpected error: Length of the value exceeds length of the field.
Result: ConversionFailed

Thanks,

Hello Dani,
We need to explore your request. We’ll be back with an answer in a couple of days.

Waiting to your answer-:slight_smile:
Thank you very much.

Hi, @danies8
I need to explore your request. I’ll be back with an answer in a couple of days.

1 Like

You already said:
Shapefile /MapInfoTab based on DBF, have restrictions for field length.
Note that: DBF field length ≤ 254 characters.

AI add:
DBF is a required part of:
Shapefile – the .dbf file contains the attribute table.
DBF can also appear in:
MapInfo TAB – usually the data is stored in .dat, but in some versions or exports, a .dbf file may also be found.
DBF is mainly associated with Shapefile, and only occasionally appears in MapInfo TAB depending on export or conversion settings.

  1. Are there more formats that are based on DBF field ?

2.Is it possible to read the input file(.dbf or .dat field) and see if it’s
DBF field length > 254 characters?
If yes to use option IsIgnoreWrongData , otherwise, not to use it.

3.If it possible , please give full code?

4.Are these the conversion that can have these problem or there are more:
Shapefile => Shapefile
Shapefile => MapfInfoTab
MapfInfoTab=> MapfInfoTab
MapfInfoTab =>Shapefile

  1. When IsIgnoreWrongData is set to false (or omitted) Aspose.GIS performs strict validation of every feature before writing the destination file.
    Invalid geometries (self‑intersections, broken rings, duplicate vertices) or attribute mismatches (field length overflow, unsupported data types) will cause the conversion to throw an exception and no output file will be produced.
    This behavior is useful when data quality is critical and you want to be notified about every problem so you can fix the source before conversion.

6.Does in this bug the problem is : the length overflow(DBF).

7.Code you suggested in past:
// MapInfoTab handling
// When this flag is set to true, the driver skips any feature whose attribute value exceeds
// the DBF field limit(254 characters).The offending records are not written to the output file,
// so they will be missing in the resulting MapInfoTab or Shapefile.You can verify the effect by opening the converted file in QGIS –
// the features with oversized attributes simply won’t appear.
else if (targetFormat.Equals(“MapInfoTab”, StringComparison.OrdinalIgnoreCase))
{
options.DestinationDriverOptions = new MapInfoTabOptions() { IsIgnoreWrongData = true };
}

// Shapefile handling
// When this flag is set to true, the driver skips any feature whose attribute value exceeds
// the DBF field limit(254 characters).The offending records are not written to the output file,
// so they will be missing in the resulting MapInfoTab or Shapefile.You can verify the effect by opening the converted file in QGIS –
// the features with oversized attributes simply won’t appear.
else if (targetFormat.Equals("Shapefile", StringComparison.OrdinalIgnoreCase))
{
    options.DestinationDriverOptions = new ShapefileOptions() { IsIgnoreWrongData = true };
}

I want to improve, detect the case on the fly and apply option if needed.

Thanks in adavnce,

Hi, @danies8

we know this issue before.
You can use IsIgnoreWrongData option for this.

It doesn’t make sense.
You can use option or not in you code.
The best way is allow user decide

  1. Are these the problematic conversions ?
    Shapefile => Shapefile
    Shapefile => MapfInfoTab
    MapfInfoTab=> MapfInfoTab
    MapfInfoTab =>Shapefile
    if yes i can detect that these conversions( the input format and output format)
    and use IsIgnoreWrongData ?
    Do you see any problem with this ?

all conversion to Shapefile and MapfInfoTab. The problem during create new layer.

yes, you can use IsIgnoreWrongData for these conversion

You said in these conversions I can use safely
IsIgnoreWrongData:

  1. IS In both casses when the source has
    Dbf fileld lenght smaller and bigger than 254? Is it?
    2.In QGIS in both casese the output and input will be the same?
    3.How can I see the lenghth of source dbf file?

4.Are there more cases of conversion that I need to use IsIgnoreWrongData? If yes state them please?

Dani, option ‘IsIgnoreWrongData’ determine should we throw exception while work with wrong data or just ignore it and continue work. Anything can happen. You should determine behavior not just special case!

I think the best way - throw exception and suggest user to use this option. Like I said user will decide depend on what he need.

Hi Alexander,

Thank you for answer.

For what you suggest to let user decide needs a big rethinking in our side.
The procees of first customer:
End user send file to test without knowing what it has inside. We need to learn the customer process
If he can want to choose options to influnce on the conversion.

Regarding this error:
Unexpected error: Length of the value exceeds length of the field.
Are these the only problematic conversions ?
Shapefile => Shapefile
Shapefile => MapfInfoTab
MapfInfoTab=> MapfInfoTab
MapfInfoTab => Shapefile
And if i used IsIgnoreWrongData it doesnt harm
Conversions above that do nottt have this bug and thier input file are valid and i used this option IsIgnoreWrongData their output will be valid?

In addition:
rail_freq_2019_kmz.zip (217.6 KB)

[KmzTest] Testing Kmz → MapInfoTab

Args: input=‘D:\GisConverter\Tests\Kmz\Input\rail_freq_2019_kmz.zip’, format=‘MapInfoTab’, output=‘D:\GisConverter\Tests\Kmz\Output\2026-06-16_14-57-07\KmzTest\MapInfoTab’, temp=‘D:\GisConverter\Tests\Kmz\Temp\2026-06-16_14-57-07\KmzTest\MapInfoTab’, logPath=‘D:\GisConverter\Tests\Kmz\Log\2026-06-16_14-57-07\kmztest_mapinfotab_log.txt’, logLevel=‘’
:x: Conversion failed.
2026-06-16T14:57:14.4668243+03:00 (Local) | 2026-06-16T11:57:14.4668243Z (UTC)
Unexpected error: Length of the value exceeds length of the field.
Result: ConversionFailed

[KmzTest] Testing Kmz → Shapefile

Args: input=‘D:\GisConverter\Tests\Kmz\Input\rail_freq_2019_kmz.zip’, format=‘Shapefile’, output=‘D:\GisConverter\Tests\Kmz\Output\2026-06-16_14-57-07\KmzTest\Shapefile’, temp=‘D:\GisConverter\Tests\Kmz\Temp\2026-06-16_14-57-07\KmzTest\Shapefile’, logPath=‘D:\GisConverter\Tests\Kmz\Log\2026-06-16_14-57-07\kmztest_shapefile_log.txt’, logLevel=‘’
:x: Conversion failed.
2026-06-16T14:57:14.9302666+03:00 (Local) | 2026-06-16T11:57:14.9302666Z (UTC)
Unexpected error: Length of the value exceeds length of the field.
Result: ConversionFailed

Length of the value exceeds length of the field, which filed, Kmz format has no DBF ?
Kmz → MapInfoTab
Kmz → Shapefile
To add these conversion to :
Shapefile => Shapefile
Shapefile => MapfInfoTab
MapfInfoTab=> MapfInfoTab
MapfInfoTab => Shapefile
and use IsIgnoreWrongData option?

Does if these 6 conversion inputs are valid and I used IsIgnoreWrongData option it will be problem?

Thanks,

all conversion to Shapefile and MapfInfoTab can be problematic

1.## KmzTest] Testing Kmz → Shapefile

Args: input=‘D:\GisConverter\Tests\Kmz\Input\rail_freq_2019_kmz.zip’, format=‘Shapefile’, output=‘D:\GisConverter\Tests\Kmz\Output\2026-06-16_14-57-07\KmzTest\Shapefile’, temp=‘D:\GisConverter\Tests\Kmz\Temp\2026-06-16_14-57-07\KmzTest\Shapefile’, logPath=‘D:\GisConverter\Tests\Kmz\Log\2026-06-16_14-57-07\kmztest_shapefile_log.txt’, logLevel=‘’
:x: Conversion failed.
2026-06-16T14:57:14.9302666+03:00 (Local) | 2026-06-16T11:57:14.9302666Z (UTC)
Unexpected error: Length of the value exceeds length of the field.
Result: ConversionFailed

Length of the value exceeds length of the field, which filed, Kmz format has no DBF ?
Kmz → MapInfoTab
Kmz → Shapefile

2.To add to only these conversion- IsIgnoreWrongData option ?
Shapefile => Shapefile
Shapefile => MapfInfoTab
MapfInfoTab=> MapfInfoTab
MapfInfoTab => Shapefile
and use IsIgnoreWrongData option?

3.Does if these 6 conversion in paragraph 2- the inputs are valid and I used IsIgnoreWrongData option it will be problem?

Please answer.

Thanks,

But Shapefile have!

Lika a said the problem during create new layer!
You make conversion to Shapefile which is base on dbf.

No, all conversion to Shapefile and MapfInfoTab can be problematic.
Cos of “Unexpected error: Length of the value exceeds length of the field.”

Sorry Alexander,

1.I read it 3 times your answer and I do not understand the problem.
In this post i reported on bug that said: “Unexpected error: Length of the value exceeds length of the field.” when converting Shapefile => Shapefile.
You said use IsIgnoreWrongData option.

So I said, I have automatic tool:
Shapefile => Shapefile
Shapefile => MapfInfoTab
MapfInfoTab=> MapfInfoTab
MapfInfoTab => Shapefile
Kmz → MapInfoTab
Kmz → Shapefile

There are two options:
1.Conversions will failed (not using IsIgnoreWrongData)
or
2.if I used IsIgnoreWrongData, the conversion will passed and when I used QGIS the comparison will be OK.

So what I miss ?

2.In this case can I use IsIgnoreWrongData options: no problem of length and
when I used QGIS the comparison will be OK ?
Shapefile => Shapefile
MapfInfoTab=> MapfInfoTab

Your quick answer will be appreciated!!

If you use IsIgnoreWrongData then not only “Length of the value exceeds length of the field” will ignore but other exception also! Anything can happen.
And you can’t be sure QGIS the comparison will be the same.

So if I used IsIgnoreWrongData option only for these cases it will be not safe, it is the same files? Length of the value exceeds length of the field is the same so for this exception it will be ok.
What other problems of these conversions to itself can be beyond-Length of the value exceeds length of the field ?
Shapefile => Shapefile
MapfInfoTab=> MapfInfoTab

Your quick answer will be appreciated!!

Input file can have invalid geometry or property value. You have only one case now, but in other sample can be other problem.
With option ‘true’ we will ignore problem if it possible and continue conversion.

OK-convinced!! -:slight_smile:

If conversion to Shapefile or MapInfoTab happened and exception thrown:
“Length of the value exceeds length of the field”

1.How can I see the length of DBF filed in Shapefile? please use the input of this conversion in the beginning of the post.
2.How can the user fix its input DBF filed length ? Can you show me a video?

Your quick answer will be appreciated!!!

Thanks,