Hi,
I have a shape file with null values in certain columns. When I read the features from this shape file, the null values are converted to the default value for that column type.
Is there a way to read the features of a shapefile so that null values are not converted to the default value for that field? Or at least give me some way to pinpoint that this cell was a null before converting?
I am using Thinkgeo Services Edition version 6.
Thanks
Reading shapefiles with null values
Hi Marius,
Sorry to say there is no such Api or events fit for this case based on the current structure. The reason is no matter what the column type is, in the last end, its value will be converted to the string, and the null-able value would be converted to the empty string as the feature ColumnValue.
I am thinking is it possible for us to replace the Null-able value with some special characters like "N/A" in the original shape file and once we detect the "N/A", we can treat this column as Null. But I also worry the "N/A" would not be compatible for every data type in shape file, So, this way is just a simple method and need more works to finish.
Hope it helps and please feel free to let us know if any questions.
Regards,
Johnny
Hi Johnny,
Thank you for clearing that for me!
I don’t have too much know-how on the details of reading a dbf file but recently I searched around for ways to read dbf files and to detect null values. I was able to do that with Microsoft’s OLE provider and some other provider which is not constrained to 8.3 file names (like the MS OLE provider is). Most of the libs out there do the conversion automatically.
Now, reading features and their metadata as nulls could be trickier but it seems to me that there are already ways to do it from dbf … just not for gis features. It would be a great feature in ThinkGeo to be able to support this because in some applications it matters a lot to know the difference between a value of 0 and a missing value.
Please let me know if the ThinkGeo team are looking forward into implementing this feature in the near future!
Thanks again!
Marius
Hi Marius,
I am afraid we don’t have any plans on it as it is decided by the current structure and also need to add more APIs to support it.
Currently, while we don’t have any plans on it, I guess we still can distinguish the null value and the default value by comparing the converted result string.
Sorry for any inconvenience.
Johnny