[GRASS-dev] [GRASS GIS] #3407: v.in.ogr fails to import ESRI Shapefile with empty attribute table cells

GRASS GIS trac at osgeo.org
Wed Aug 23 00:46:09 PDT 2017


#3407: v.in.ogr fails to import ESRI Shapefile with empty attribute table cells
---------------------+-------------------------
 Reporter:  mikatt   |      Owner:  grass-dev@…
     Type:  defect   |     Status:  new
 Priority:  normal   |  Milestone:
Component:  Default  |    Version:  7.2.1
 Keywords:           |        CPU:  x86-64
 Platform:  Linux    |
---------------------+-------------------------
 GRASS 7.2.1 (on Linux Mint 18) produces an error when trying to read in
 ESRI shapefiles that have empty cells. This used to work fine until
 recently, and I have no problems with GRASS 7.2.0 on Windows 7.

 Here is a minimal example including messages:

 Create a point vector from csv (note the empty 'val' cell in the last
 line):
 {{{
 v.in.ascii --overwrite input=points.csv output=points_imp_g
 separator=comma skip=1 columns=num integer,X double precision,Y double
 precision,val double precision x=2 y=3

 v.db.select map=points_imp_g
 cat|num|X|Y|val
 1|1|2487491.643|5112118.33|1.5
 2|2|2481985.459|5109162.78|2.3
 3|3|2478284.289|5105331.04|
 }}}

 Export to ESRI shape (works fine):
 {{{
 v.out.ogr input=points_imp_g output=points_exp_g format=ESRI_Shapefile
 output_layer=points_exp_g

 Exporting 3 features...
 v.out.ogr complete. 3 features (Point type) written to <points_exp_g>
 (ESRI_Shapefile format).
 }}}

 Import the created shape fails:
 {{{
 v.import input=points_exp_g/points_exp_g.shp layer=points_exp_g
 output=points_imp_g2

 WARNING: All available OGR layers will be imported into vector map
 <points_exp_g>
 Check if OGR layer <points_exp_g> contains polygons...
 Column name <cat> renamed to <cat_>
 Importing 3 features (OGR layer <points_exp_g>)...
 DBMI-SQLite driver error:
 Error in sqlite3_prepare():
 near ")": syntax error
 DBMI-SQLite driver error:
 Error in sqlite3_prepare():
 near ")": syntax error
 ERROR: Cannot insert new row: insert into points_imp_g2 values ( 3, 3, 3,
 2478284.288999999873340, 5105331.040000000037253,  )
 ERROR: Unable to import <points_exp_g/points_exp_g.shp>
 }}}

 Have there been substantial changes to v.in.ogr or could this be a
 RGDAL/OGR issue?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3407>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list