[Qgis-developer] comments about manageR plugin

volkan kepoglu vkepoglu at gmail.com
Tue May 6 04:11:37 EDT 2008


Dear carson,

I tried the manageR plugin 0.04 yesterday night and loved the way of
coupling with R.
I have two suggections/improvements for manageR. But not sure, it is the
general
situation or specific to my environment. R is 2.6.1. QGIS is
0.9.2-rc1-Ganymede.

1. Although rgdal is installed on Ubuntu Gutsy 7.1, manageR could not find
it.
Sometimes, external R packages like rgdal could not be installed on default
folder with
install.packages() commands. In my case, I could not installed it under
default
folder, because it has not got a write permission on default folder in
Ubuntu,
or the user can delibaretly install the packages under different folders.

So, I recommend you to search user specified folders.
This path can be return in R as below.

# it seems that rgdal is not installed.
# search() is not enough for user/custom package installation paths.
> search()
[1] ".GlobalEnv"        "package:stats"     "package:graphics"
[4] "package:grDevices" "package:utils"     "package:datasets"
[7] "package:methods"   "Autoloads"         "package:base"

# .libPaths() returns all paths that the packages are installed.
> .libPaths()
[1] "/home/vkepoglu/R/i486-pc-linux-gnu-library/2.5"
[2] "/usr/local/lib/R/library"

# rgdal can be loaded directly with library() inside R, but not inside of
python,
# due to different path installation.
> library(rgdal)
Loading required package: sp

Geospatial Data Abstraction Library extensions to R successfully loaded
>

# so please, also add "lib.loc" options in your plugin code. for example:
> library(maptools, lib.loc=.libPaths()[1])
Loading required package: foreign
>

2. About unicode
I have turkish characters. In general, we use utf-8 unicode. In QGIS, no
error occurs
due to turkish characters. I can add those files (has turkish characters in
file name or in path).
In the open file dialog of QGIS, at the bottom encoding is System, by
default. No need to change it.
It is working. I know that utf-8 has almost all characters in the world,
I suppose. I changed latin1 in your plugin to utf-8. In both cases
(tried latin1 or utf-8), the error is occured.  I do not know, why?

If the path of added vector layer has turkish character like
"ğüşiçöĞÜŞİÖÇı", the error is:

An error has occured while executing Python code:

Traceback (most recent call last):
 File "/usr/local/share/qgis/python/plugins/manageR/domanageR.py", line 119,
in load
  self.convert(inName)
 File "/usr/local/share/qgis/python/plugins/manageR/domanageR.py", line 155,
in convert
  self.commands(str(inName) + " UnicodeEncodeError: 'ascii' codec can't
encode character
  u'\u015f' in position 51: ordinal not in range(128)

If the name of added vector layer has turkish character (and path has no
turkish character), the error is:

First says Unable to Load layer with message box, and then,

An error has occured while executing Python code:

Traceback (most recent call last):
 File "/usr/local/share/qgis/python/plugins/manageR/domanageR.py", line 119,
in load
  self.convert(inName)
 File "/usr/local/share/qgis/python/plugins/manageR/domanageR.py", line 144,
in convert
  dsn = mlayer.source()
AttributeError: 'NoneType' object has no attribute 'source'

I also tried the plugin on win in which installed R but not rgdal.
the plugin installs rgdal via the normal R procedure. The procedure is
working very well.

Unicode problem is very important for me. If you solve it, please, let me
know.
I am thinking to use your plugin.

Regards,
volkan kepoglu





Date: Sun, 4 May 2008 18:18:37 +0000
From: cfarmer at uvic.ca
Subject: [Qgis-user] Re: calculate statistics on an attribute table
To: qgis-user at lists.osgeo.org, amagine at telus.net
Message-ID:

 <143599603-1209925102-cardhu_decombobulator_blackberry.rim.net-129579947- at bxe117.bisx.prod.on.blackberry
>

Content-Type: text/plain; charset="Windows-1252"

Mars Sjoden pisze:

> Is there a way to quickly calculate statistics on an attribute table
> column?

I have created a plugin to do just this:

For those of
you who might be interested, the plugin is available via the plugin
installer if you add
http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml to your list of
available QGIS plugin repositories:

Open plugin installer
Click add
Give 'cfarmer repository' for name (or whatever you want...)
Give http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml for URL
Click 'get list'
And look for 'Calculate field statistics' (I think that's what I named it?)
There are plenty of other tools there for you to check out as well...

Cheers,

Carson
Sent from my BlackBerry(R) wireless device
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20080506/2bf201bb/attachment-0001.html


More information about the Qgis-developer mailing list