<div dir="ltr"><div style>When loading into a PostgreSQL/PostGIS database, can the VRT/CSV driver convert missing values (for a "Real" field) to NULL instead of defaulting to 0.00?</div><div style><br></div><div style>
Example:</div><div style><br></div><div style>I'm attempting to load a CSV file into PostgreSQL using the following simple VRT file:<br></div><div><br></div><div>--------------------------------------------------------</div>
<div><div><OGRVRTDataSource></div><div> <OGRVRTLayer name="sfcdump"></div><div> <SrcDataSource relativeToVRT="1">sfcdump.csv</SrcDataSource></div><div> <GeometryType>wkbPoint</GeometryType></div>
<div> <LayerSRS>WGS84</LayerSRS></div><div> <GeometryField encoding="PointFromColumns" x="longitude" y="latitude"/></div></div><div><div> <Field name="stnid" src="stnid" type="String"/></div>
</div><div><div> <Field name="latitude" src="latitude" type="Real"/></div><div> <Field name="longitude" src="longitude" type="Real"/></div>
</div><div><div> <Field name="td" src="td" type="Real"/></div></div><div> <Field name="t" src="t" type="Real"/><br></div><div><div> </OGRVRTLayer></div>
<div></OGRVRTDataSource></div></div><div>--------------------------------------------------------</div><div><br></div><div style>Some of the records do not have any value for the "td" column; for example, this single-record CSV:</div>
<div style><br></div><div style>--------------------------------------------------------</div><div style>stnid,lat,lon,td,t</div><div style>KOVE,39.490002,-121.620003,,283.0019<br></div><div style>--------------------------------------------------------<br>
</div><div style><br></div><div style>When records such as these are loaded into the database using ogr2ogr, the missing value becomes 0.00 rather than NULL.</div><div style><br></div><div style>Is this expected behavior? Is there any way to tell the VRT/CSV driver how to handle missing/null values for numeric fields? </div>
<div style><br></div><div style>Additionally, I've noticed that blank/missing values for String columns get imported as empty strings rather than NULL (but perhaps that's the expected behavior in this case).</div>
<div style><br></div><div style>Thanks,</div><div style>Jason</div><div style><br></div><div style><br></div></div>