Shapefile Import (Integer NULL -> 0)

49 views
Skip to first unread message

HansGIS

unread,
Jan 13, 2017, 6:45:23 AM1/13/17
to SpatiaLite Users
Hello,

I'm importing a MultiPolygon Shapefile into Spatialite (4.4.0 RC0 x64 Windows). (see attachment)

The attribute "dissolve-g" is of the type Integer. The "dissolve-g" attribute is NULL for the feature with the ROWID 12.
When I import the Shapefile into Spatialite it will be converted to "0". Shouldn't that be NULL as well?

Here is the SQL Statement to import the Shapefile:
SELECT ImportSHP('C:\...\complexPolygons', 'test', 'CP1252', 32633, 'the_geom', 'PrimaryKey', 'AUTO', 0, 0, 1, 1);


Is that the desired behaviour? In my opinion it shouldn't be.
polygons.zip

a.fu...@lqt.it

unread,
Jan 13, 2017, 7:01:14 AM1/13/17
to spatiali...@googlegroups.com
On Fri, 13 Jan 2017 03:45:23 -0800 (PST), HansGIS wrote:
> The attribute "dissolve-g" is of the type Integer. The "dissolve-g"
> attribute is NULL for the feature with the ROWID 12.
> When I import the Shapefile into Spatialite it will be converted to
> "0". Shouldn't that be NULL as well?
>

Hi Hans,

you surely know that any shapefile stores its tabular data into a
DBF file: unhappily the baseline dBase-DBF spec does not support
NULL values in any way (NULLs were introduced later by some non
canonical DBF extension, e.g. the ones created by FoxPro, but
this simply adds more chaos to an intrinsically flimsy format).

the sad consequence is that different libraries supporting
the DBF format adopt different interpretations while
encountering unexpected missing / unspecified values.

the specific interpretation adopted by SpatiaLite is strictly
based on the baseline dBase specification, and consequently
any "empty" value will be considered as a ZERO for numeric
columns, and as an empty string ("" - 0 bytes length) for
text columns.

bye Sandro

mj10777

unread,
Jan 13, 2017, 7:20:05 AM1/13/17
to SpatiaLite Users
This was also a topic on the QGIS forum a week (or so) ago
- the final conclusion was also to ignore the MS innovation
- it was also noted that support for FoxPro has been discontinued since 2007

Mark 

bye Sandro

HansGIS

unread,
Jan 13, 2017, 9:14:46 AM1/13/17
to SpatiaLite Users
Yes I knew of the dBase-DBF spec.

I just thought as QGIS is a standard (and I guess gdal as a base) and it allow NULL values...
That might be a reason to think about supporting NULL values. Maybe a solution would be to have a parameter in ImportSHP() to allow for non dBase-DBF spec. NULL values?

Anyway. Thanks for the answer!

Stefan Keller

unread,
Jan 19, 2017, 10:02:27 AM1/19/17
to spatiali...@googlegroups.com
As a sidenote: If there's a chance, how about trying to replace
Shapefiles by more a modern format, like GeoPackage?

:Stefan
> --
> You received this message because you are subscribed to the Google Groups
> "SpatiaLite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to spatialite-use...@googlegroups.com.
> To post to this group, send email to spatiali...@googlegroups.com.
> Visit this group at https://groups.google.com/group/spatialite-users.
> For more options, visit https://groups.google.com/d/optout.

mj10777

unread,
Jan 19, 2017, 10:05:02 AM1/19/17
to SpatiaLite Users


On Thursday, 19 January 2017 16:02:27 UTC+1, Stefan wrote:
As a sidenote: If there's a chance, how about trying to replace
Shapefiles by more a modern format, like GeoPackage?
Or even one step further
- use spatialite Databases in QGIS

Mark 
Reply all
Reply to author
Forward
0 new messages