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

Lauri Kajan lauri.kajan at gmail.com
Tue Oct 25 04:49:50 EDT 2011


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.
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?

Thanks

-Lauri Kajan


More information about the Qgis-developer mailing list