[GRASS-dev] [GRASS GIS] #1763: Cannot scan date: on mapinfo imported map

#1763: Cannot scan date: on mapinfo imported map
----------------------+-----------------------------------------------------
Reporter: pertusus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: 6.4.2
Keywords: | Platform: Linux
      Cpu: x86-64 |
----------------------+-----------------------------------------------------
I import a mapinfo .mif (with .mid) mapset, with the following command:

{{{
v.in.ogr dsn=cartorisque_departement_01/
layer=01_ATLAS_INONDATION_ZONE_INONDABLE output=zone_inondable_01
}}}

But when I do a v.db.select on the result, I get

{{{
v.db.select zone_inondable_01
cat|IDENT|DOCUMENT|AUTEUR|DATE_APPROBATION|DATE_APPROBATION_AFFICHEE|PRECISION|RISQUE|THEME|CODE_DEGRE|DEGRE|LABEL|LIEN_RAPPORT|TAILLE_RAPPORT|LIEN_REGLEMENT|TAILLE_REGLEMENT|FOURNISSEUR|DATE_IMPORT
DBMI-SQLite driver error:
Cannot scan date:

ERROR: Unable to fetch data from table <zone_inondable_01>
}}}

Reading the code, I see in db/drivers/sqlite/fetch.c, l. 167

{{{
             ns = sscanf(text, "%4d-%2d-%2d", &dt->year, &dt->month,
&dt->day);
             if (ns != 3) {
                 append_error("Cannot scan date:");
                 append_error(text);
                 report_error();
                 return DB_FAILED;
             }
}}}

The columns with DATE type are DATE_APPROBATION and DATE_IMPORT:

{{{
  v.info -c zone_inondable_01
Displaying column types/names for database connection of layer 1:
INTEGER|cat
INTEGER|IDENT
CHARACTER|DOCUMENT
CHARACTER|AUTEUR
DATE|DATE_APPROBATION
CHARACTER|DATE_APPROBATION_AFFICHEE
CHARACTER|PRECISION
CHARACTER|RISQUE
CHARACTER|THEME
CHARACTER|CODE_DEGRE
CHARACTER|DEGRE
CHARACTER|LABEL
CHARACTER|LIEN_RAPPORT
CHARACTER|TAILLE_RAPPORT
CHARACTER|LIEN_REGLEMENT
CHARACTER|TAILLE_REGLEMENT
CHARACTER|FOURNISSEUR
DATE|DATE_IMPORT
}}}

$ ogrinfo . 01_ATLAS_INONDATION_ZONE_INONDABLE DATE_IMPORT

shows that all dates as null, like
{{{
   DATE_APPROBATION (Date) = (null)
   DATE_IMPORT (Date) = (null)
}}}
but I am not sure it is true. To check all are null I used:

{{{
ogrinfo . 01_ATLAS_INONDATION_ZONE_INONDABLE |grep 'DATE_APPROBATION
\|DATE_IMPORT '
}}}

I have put a tar.gz to reproduce the issue at

http://pertusus.free.fr/bug_grass.tar.gz

The script is cartorisque_departement.sh you could have to edit it to find
grass.

{{{
wget http://pertusus.free.fr/bug_grass.tar.gz
tar xzvf bug_grass.tar.gz
cd bug_grass && ./cartorisque_departement.sh
}}}

Maybe the bug is somewhere in ogr, I cannot really tell.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1763&gt;
GRASS GIS <http://grass.osgeo.org>

#1763: Cannot scan date: on mapinfo imported map
-----------------------------------------+----------------------------------
Reporter: pertusus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: 6.4.2
Keywords: v.in.ogr, sqlite, ogr, date | Platform: Linux
      Cpu: x86-64 |
-----------------------------------------+----------------------------------
Changes (by martinl):

  * keywords: => v.in.ogr, sqlite, ogr, date

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1763#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>