Opened 12 years ago

Last modified 9 years ago

#1763 new defect

Cannot scan date: on mapinfo imported map

Reported by: pertusus Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Vector Version: 6.4.2
Keywords: v.in.ogr, sqlite, ogr, date Cc:
CPU: x86-64 Platform: Linux

Description

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.

Change History (2)

comment:1 by martinl, 12 years ago

Keywords: v.in.ogr sqlite ogr date added

comment:2 by neteler, 9 years ago

Milestone: 6.4.36.4.6
Note: See TracTickets for help on using tickets.