Opened 18 years ago

Last modified 18 years ago

#1090 closed defect (invalid)

OGR: NULL attribute value not written properly in ESRI Shapefile

Reported by: amagnum2@… Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: blocker Keywords:
Cc:

Description

I am trying to merge several shp files with ogr2ogr and I found that when ogr 
writes the output it does not handle the NULL values properly. Instead garbage 
is written.
Under GML output, there are no issues with NULL - the property is simply 
excluded from the feature so I am guessing the issue is with ESRI output.
I found that regardless of the -append flag of ogr2ogr this problem exists.

I am attaching a sample SHP file. The command line I use for ogr2ogr:
ogr2ogr -f "ESRI Shapefile" myshp.shp  tgr20209lkA.shp tgr20209lkA

When opening the DBF file in Excel, you can see the grabage data in some of 
the rows.

Attachments (2)

kansas_city_streets.zip (493.6 KB ) - added by amagnum2@… 18 years ago.
ESRI shapefile with nulls
myshp.zip (496.3 KB ) - added by amagnum2@… 18 years ago.
output shp file

Download all attachments as: .zip

Change History (5)

by amagnum2@…, 18 years ago

Attachment: kansas_city_streets.zip added

ESRI shapefile with nulls

comment:1 by warmerdam, 18 years ago

Ariel,

Can you provide your "myshp.shp" and the source "tgr20209lkA.shp"? 

I tried translating a dataset to shape format that has null attributes
and displayed it in Excel and it seemed fine.  I suspect the issue is 
specific to particular field types, or possibly relates to your source
dataset. 

by amagnum2@…, 18 years ago

Attachment: myshp.zip added

output shp file

comment:2 by amagnum2@…, 18 years ago

(In reply to comment #2)
> Ariel,
> Can you provide your "myshp.shp" and the source "tgr20209lkA.shp"? 
> I tried translating a dataset to shape format that has null attributes
> and displayed it in Excel and it seemed fine.  I suspect the issue is 
> specific to particular field types, or possibly relates to your source
> dataset. 


The input shp file is already attached to the bug as "ESRI shapefile with 
nulls"
I have now attached the output as "output shp file".


Ariel

comment:3 by amagnum2@…, 18 years ago

Checked with latest, bug is fixed.
Note: See TracTickets for help on using tickets.