[Qgis-user] Point sampling tool

Javier Bustamante javier.bustamante.diaz at gmail.com
Mon Aug 13 19:09:21 PDT 2012


Thank you for your help. I found a solution in my case. I post it here, just 
in case someone has the same problem.

It seems that Point Sampling Tool plugin crasses if it finds non-ascii 
characters in the names of the shapefiles or in the shapefile field names. I 
guess, it may also happen if it is in the name of the raster.  Line 98 of the 
script is where the names of the files in the Q-gis project are read.

This was my situation as there was one shapefile field name with a non-ascii 
character. Removing or renaming this field solved the problem.

Non-ascii characters as values in the attribute table do not create the 
problem, although they are not exported correctly.

I have not tested Salvatore patch.

Javier

On Lunes, 13 de Agosto de 2012 10:30:47 Salvatore Larosa escribió:
> 2012/8/13 Javier Bustamante <javier.bustamante.diaz at gmail.com>
> 
> > **
> > 
> > Hi, I am new to the list.
> > 
> > 
> > 
> > I am trying to use the "Point Sampling Tool" plugin to extract some
> > raster values at specified sampling points.
> > 
> > 
> > 
> > I have installed the Point Sampling Tool plugin (0.3.3) on Q-gis 1.7.4
> > under Kubuntu 11.10 (linux).
> > 
> > 
> > 
> > We I try to use the tool
> > 
> > I get the following error:
> > 
> > 
> > 
> > An error has occured while executing Python code:
> > 
> > Traceback (most recent call last):
> >   File
> > 
> > "/home/busta/.qgis/python/plugins/pointsamplingtool/doPointSamplingTool.
> > py", line 98, in updateFieldsList
> > 
> >     self.inData.addItem(str(self.sampItems[i][0].name()) + " : " +
> > 
> > str(self.sampItems[i][j][0]) + " (source point)")
> > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in
> > position 3: ordinal not in range(128)
> > 
> > Python version:
> > 2.7.2+ (default, Oct  4 2011, 20:29:37)
> > [GCC 4.6.1]
> > 
> > 
> > QGIS version:
> > 1.7.4-Wroclaw Wroclaw, exported
> > 
> > Python path: ['/usr/share/qgis/python', '/home/busta/.qgis/python',
> > '/home/busta/.qgis/python/plugins', '/usr/share/qgis/python/plugins',
> > '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
> > '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
> > '/usr/lib/python2.7/lib-dynload',
> > '/usr/local/lib/python2.7/dist-packages',
> > '/usr/lib/python2.7/dist-packages',
> > '/usr/lib/python2.7/dist-packages/PIL',
> > '/usr/lib/python2.7/dist-packages/gtk-2.0',
> > '/usr/lib/pymodules/python2.7',
> > '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode',
> > '/usr/share/qgis/python/plugins/fTools/tools',
> > '/media/Iomega_HDD/spartina_modelos/Clasificacion_ahs_casi/shp']
> > 
> > 
> > 
> > Can someone suggest some possible solution?
> 
> Hi Javier,
> try with the attached patch, should solve the issue!
> I don't know if exist a bugtracker for pointsampling plugin, if so,  it's
> the right place to report this bug!
> 
> Also, consider upgrading QGIS!!
> 
> Cheers,
> 
> -SL
-- 
Dr Javier Bustamante
Estación Biológica de Doñana, CSIC
Dept. Wetland Ecology
Américo Vespucio s/n
41092 - Sevilla
Spain

voice: +34 954 466700 ext. 1217
fax: +34 954 621125
e-mail: jbustamante at ebd.csic.es

http://www.ebd.csic.es/bustamante/index.html

-----other links-------
http://last-ebd.blogspot.com/
http://euroconbio.blogspot.com/



More information about the Qgis-user mailing list