Empty attribute table of shp file

May 14, 2014 at 6:50 PM
Hi there,
I am learning the examples of the tutorial (Developer's corner.pdf) and find that the CalculateArea and GenerateCentroid tools create .shp file correctly, but the .dbf file is only 1KB in size, yielding an empty attribute table.
By the way, is there a plugin template that references Ver 1.6 assembles? The one I downloaded sticks to Ver 1.0.
Thanks.

Zhiyu Li
Developer
May 15, 2014 at 5:44 AM
Hi, i checked the source code for CalculateArea and GenerateCentroid and it seems that everything is fine there. The output .dbf should be non-empty and must contains data from input shapefile. Are you sure that your input shapefiles has some .dbf data?

Yes, it seems that template a bit is out of date. We should update it. But as you can see the template code is quite easy and you can create your own plugins without this template.
May 15, 2014 at 4:10 PM
Hi mogikanin:
I tested the CalculateArea tool with the world_countries shape files obtained from the online sample data ‘DotSpatial.SampleProjects.World.1.2.5’. The original has 8 fields with 239 entries, while the output dbf file contains an empty attribute table with two newly added fields, ‘Area’ and ‘FID’. Then I try to open the output shape files in ArcMap and got an error ‘Failed to open the dataset. Number of shapes does not match the number of table records’.
Thanks.

Zhiyu
Developer
May 20, 2014 at 2:37 PM
Hi Zhiyu,

thanks for reporting this. I reproduced this issue in both tools. Now it's fixed in trunk.

Maxim.
Marked as answer by jany_ on 9/9/2014 at 1:32 AM