Matteo,
I suspect that QGIS converts empty strings to nulls.
Have you tried using ogr2ogr or another tool to replace empty strings
with strings starting with '\0'?
Kind regards,
Ben.
On 24/10/17 19:20, Matteo Cusmai wrote:
Hi Ben,
Yes, I'm using esri shape file, this is a requirement.
However, if I access the same files with qgis, I see null values, do you
know why?
On 23 Oct 2017 23:38, "Ben Caradoc-Davies" <b...@transient.nz> wrote:
Matteo,
what is the source of your data? ESRI software and the older DBF format
often used in shapefiles do not natively support nulls because all fields
are stored as strings:
http://support.esri.com/en/technical-article/000005811
https://en.wikipedia.org/wiki/Shapefile#Data_storage
https://gis.stackexchange.com/questions/28411/how-to-have-a-
nullable-field-included-in-a-shapefile-using-the-geotools-library
When reading a DBF file, GeoTools will treat numeric fields that are empty
or all whitespace or start with '*' as null, and character fields that
start with a null terminator byte ('\0') as null. You can see the logic
here:
https://github.com/geotools/geotools/blob/master/modules/plu
gin/shapefile/src/main/java/org/geotools/data/shapefile/
dbf/DbaseFileReader.java#L452
Can you use a format like geopackage that has native support for nulls?
Kind regards,
Ben.
On 24/10/17 01:05, Matteo Cusmai wrote:
Hi all,
I need to read some shapefiles where some field are nillable and so they
could have null value.
The problem is that, I don't know why, the features has empty string where
should be null.
Does someone have the some problem?
Regards,
Matteo Cusmai
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users