#30020: Support reading null values for numeric fields on Shapefile import via
LayerMapping
-------------------------------------+-------------------------------------
               Reporter:  Kathryn    |          Owner:  nobody
  Killebrew                          |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  GIS        |        Version:
               Severity:  Normal     |       Keywords:  GIS, GEOS,
           Triage Stage:             |  LayerMapping
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 On reading a Shapefile into a model object via `LayerMapping`, set numeric
 field value to `None` instead of zero if the model field is nullable and
 input field value is either null or unset. Currently, both nulls and
 zeroes in the input are stored as zeroes.

 Shapefiles do not officially support storing nulls:
 
http://resources.esri.com/help/9.3/ArcGISDesktop/com/Gp_ToolRef/geoprocessing_tool_reference/geoprocessing_considerations_for_shapefile_output.htm

 However, on inspecting the DBF contents via `ogrinfo` with GDAL 2.1 or
 2.2, both zeroes and nulls display, so some unofficial support exists.

 GDAL 2.2 added support for distinguishing between "unset" fields and those
 explicitly set to null:
 https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues

 Adding null support should be possible by either checking before casting
 the value with OGR `IsFieldSetAndNotNull` on GDAL 2.2+ or checking with
 OGR `IsFieldSet` on older GDAL versions:
 https://www.gdal.org/classOGRFeature.html#a260b925400b72914eb1b8cc9a3bf4029

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30020>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/058.28407d91d0279153d80d2a76308b0b26%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to