[Qgis-developer] How null values are handled in a shapefiles?

Martin Dobias wonder.sk at gmail.com
Tue Oct 25 14:34:02 EDT 2011


Hi Lauri

On Tue, Oct 25, 2011 at 5:49 AM, Lauri Kajan <lauri.kajan at gmail.com> wrote:
> Hi all,
>
> Giovanni Manghi run to a problem with NULL values in a shapefiles
> (earlier post). I tested it but couldn't reproduce the error in 1.7.1.
> But I found out some other issues with NULL handling in shapefiles.
>
> Shapefiles don't support null values at least not in ESRI-world.
> Though OGR should support reading and writing null values with
> shapefiles. Don't know how but it should.

My understanding is that NULL values in dBase files (accompanying
shapefiles) is a sort of extension of original file format and not all
software support it.

> When I opened a shapefile created by arcgis geoprosessor, qgis somehow
> shows all the 0 and '' values as a NULL values. I'm now able to search
> a field with IS NULL syntax and qgis returns what is expected. I'm
> also able to modify the table and change some values to real zeros.
> Now a search finds only 0 values when searched [field] = 0. But when I
> save this layer with Save as... to a new shapefile all the NULL values
> in numeric fields are converted to 0 and in text field to ''. In the
> attribute table '' values in text fields still shows as NULL but when
> I try to search only [field] = '' works. All zeros in numeric fields
> shows as 0 and not NULL.
>
> Is there some logic or is this a bug to report?

Such inconsistent behavior is worth a bug report, do not forget to
attach a test shapefile.

Martin


More information about the Qgis-developer mailing list