[GRASS-dev] [GRASS GIS] #1633: Unable to display shapefile attribute table due to pipe characters in dbf field

GRASS GIS trac at osgeo.org
Tue Apr 3 04:20:39 EDT 2012


#1633: Unable to display shapefile attribute table due to pipe characters in dbf
field
-------------------------+--------------------------------------------------
 Reporter:  richardc     |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  critical     |   Milestone:  6.4.3                    
Component:  Display      |     Version:  6.4.1                    
 Keywords:               |    Platform:  Linux                    
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------
 Hi,

 I'm receiving the following error on attempting to view the attribute
 table of shapefiles in GRASS 6.4.1.2 (on Ubuntu Lucid):


 item = layer, log = self.goutput)
   File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py",
 line 653, in __init__

 self.__createBrowsePage()
   File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py",
 line 698, in __createBrowsePage

 self.mapDBInfo, layer)
   File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py",
 line 95, in __init__

 keyColumn = self.LoadData(layer)
   File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py",
 line 247, in LoadData

 self.AddDataRow(i, record, columns, keyId)
   File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py",
 line 286, in AddDataRow

 if self.columns[columns[j]]['ctype'] != types.StringType:
 IndexError
 :
 list index out of range

 '''Method:'''
 I import the shapefile as follows:

 Layer Manager > File > Import vector data > Common import formats > Select
 ESRI shapefile > Browse and select file > Import

 And then select the layer in 'Layer Manager', and click on the 'Show
 attribute table' icon. Then the error results

 'Please wait loading attribute data..' with the following in the command
 console -

 if self.columns[columns[j]]['ctype'] != types.StringType:
 IndexError
 :
 list index out of range


 On closer inspection of the dbf file, some of the fields contain pipe
 (i.e., '|') characters. On removing these the attribute table can be
 displayed.

 QGIS is able to display all data in the attribute table, including 'pipe'
 characters.

 Example of problem fields in single column named 'VARNAME_1,C,150':

 VARNAME_1,C,150

 Bangkok|Krung Thep|Krung Thep Maha Nakhon|Phra Nakhon-Thonburi
 Buri Rum
 Chaxerngsao|Pad Rew|Paed Riu|Petrieu|Shajeun Dhrao
 Chainat
 Chantaburi|Muang Chan

 NOTE: issue posted originally at http://osgeo-org.1560.n6.nabble.com
 /Index-error-Unable-to-show-attribute-table-of-shapefile-
 tp4678952p4678952.html

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1633>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list