[GRASS-user] v.out.ogr and Date fields

Daniel McInerney daniel.o.mcinerney at gmail.com
Mon Nov 4 03:23:21 PST 2019


Hi List,

As part of a workflow, we are importing ESRI Shapefiles into GRASS so 
that we can manage the vector topology, before re-exporting the vectors 
back to an ESRI Shapefile. However, we noticed that the date fields are 
being converted from a field of type Date to type String. Hopefully the 
following steps will demonstrate the issue:

The input Shapefile is scdb_date, with a date field called 'BA_DATE':

 >ogrinfo -so -al scdb_date.shp | grep BA_DATE
BA_DATE: Date (10.0)

After importing into GRASS using v.in.ogr, the field is still of type 
DATE (although the length has increased to 20):

 >db.describe scdb_date | grep -A 5 BA_DATE
column:BA_DATE
description:
type:DATE
len:20
scale:0
precision:0

However, when I export the vector (scdb_date) back to an ESRI Shapefile 
using v.out.ogr, the BA_DATE is converted to a String:

v.out.ogr input=scdb_date output=scdb_date_export.shp 
format='ESRI_Shapefile'

 >ogrinfo -so -al scdb_date_export.shp | grep 'BA_DATE'
BA_DATE: String (20.0)

I tried exporting to a GeoPackage, but the issue persists. While, we can 
still overcome this issue using ogr and SQL, I am wondering if is there 
a flag or option in v.out.ogr that I am overlooking that would maintain 
the fields of type Date or is there something else that I should consider?

Thanks in advance.

best regards,
Daniel.




More information about the grass-user mailing list