Re: [Qgis-developer] Multiple Fields in R-Processing

2016-10-01 Thread matteo
Victor,

I found the file in the folder. This the output (same error for several
different layers and different fields):

matteo@matteo-computer:~/.qgis2/processing$ cat processing_script.r.Rout

R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> options("repos"="http://cran.at.r-project.org/;)
> tryCatch(find.package("rgdal"), error=function(e)
install.packages("rgdal", dependencies=TRUE))
[1] "/home/matteo/R/x86_64-pc-linux-gnu-library/3.2/rgdal"
> tryCatch(find.package("raster"), error=function(e)
install.packages("raster", dependencies=TRUE))
[1] "/home/matteo/R/x86_64-pc-linux-gnu-library/3.2/raster"
> library("raster")
Loading required package: sp
> library("rgdal")
rgdal: version: 1.1-10, (SVN revision 622)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.11.3, released 2015/09/16
 Path to GDAL shared files: /usr/share/gdal/1.11
 Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-3
> layer =
readOGR("/tmp/processing36b3e4f556d548f9bcf7d4f8911f1b4d",layer="1475338756.053")
OGR data source with driver: ESRI Shapefile
Source: "/tmp/processing36b3e4f556d548f9bcf7d4f8911f1b4d", layer:
"1475338756.053"
with 313 features
It has 12 fields
>  multiple field layer="__count;__mean;__sum"
Error: unexpected symbol in " multiple field"
Execution halted



Super thanks again for helping me

Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-10-01 Thread Victor Olaya
ah, ok, that might be it

can you check the temporary R file that is created when running the
algorithm? that should tell you how the parameter is pased to R, since
that is an R script

You should find it in ~/.qgis2/processing

regards


2016-10-01 18:21 GMT+02:00 matteo :
> Hi Victor,
>
> again, thanks for the support.
>
> I still have troubles.. always the same error (actually lower or
> uppercase is the same)..
>
> I'm talking of R scripts, not python ones.. are there differences?
>
> Thanks again
>
> Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-10-01 Thread Victor Olaya
mmm, it is working for me

this works fine

##layer=vector
##fields=multiple field layer

print fields


Notice that it is "multiple field", all in lower case. You example
says "multiple Field", which is wrong. Maybe is that?



2016-09-30 10:19 GMT+02:00 matteo :
> Hi Victor,
>
> thanks for your answer..
>
>> The value of the multiple flieds is a string with field names
>> separated by semicolons
>>
>> so, to get a list of them:
>>
>> fields = multiple_fields.split(";")
>>
>> Not sure this is what you need...maybe I am not understanding the 
>> question
>
> actually not :)
>
>
> a small example is.. I have a vector layer with some fields and I want
> to perform normality test on some of the fields..
>
> so I have 2 options:
>
> 1. create many ##field1 = Field Layer and give to some of them the label
> optional because the user doesn't know how many fields would be in input..
>
> 2. use ##fields = multiple Field Layer that, as you said, throws out a
> list with all the field names separated by ";" and loop on that columns
>
> now the problem with my R script is that I cannot get the variable with
> the selected fields, for example:
>
> ##Vector processing=group
> ##Layer=vector
> ##fields = multiple Field Layer
>
> aa = fields
>
>>aa
>
> even to do in this way (so just printing the entire string of all the
> field names) throws the error:
>
> Error: unexpected symbol in " multiple Field"
>
>
> I try your suggestion (f = fields.split(";")) but I get the same error
> of above again.
>
> For sure I'm missing something, but I really don't understand what..
>
> Thanks again Victor!
>
> Cheers
>
> Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-09-30 Thread matteo
Hi Victor,

thanks for your answer..

> The value of the multiple flieds is a string with field names
> separated by semicolons
> 
> so, to get a list of them:
> 
> fields = multiple_fields.split(";")
> 
> Not sure this is what you need...maybe I am not understanding the question

actually not :)


a small example is.. I have a vector layer with some fields and I want
to perform normality test on some of the fields..

so I have 2 options:

1. create many ##field1 = Field Layer and give to some of them the label
optional because the user doesn't know how many fields would be in input..

2. use ##fields = multiple Field Layer that, as you said, throws out a
list with all the field names separated by ";" and loop on that columns

now the problem with my R script is that I cannot get the variable with
the selected fields, for example:

##Vector processing=group
##Layer=vector
##fields = multiple Field Layer

aa = fields

>aa

even to do in this way (so just printing the entire string of all the
field names) throws the error:

Error: unexpected symbol in " multiple Field"


I try your suggestion (f = fields.split(";")) but I get the same error
of above again.

For sure I'm missing something, but I really don't understand what..

Thanks again Victor!

Cheers

Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-09-29 Thread Victor Olaya
Sorry for the late reply

The value of the multiple flieds is a string with field names
separated by semicolons

so, to get a list of them:

fields = multiple_fields.split(";")

Not sure this is what you need...maybe I am not understanding the question

2016-09-22 15:44 GMT+02:00 matteo :
> Victor,
>
> thanks for the super quick reply.
>
> I still don't get how can I select the different single fields from the
> output.
>
> I mean, with the selection parameter all is straightforward.
>
> In the example I wrote in the previous mail, how can I access the first
> field of the multiple fields parameter?
>
> Thank Victor for your time, if I manage how to do it, I will also
> improve the documentation
>
> Cheers
>
> Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-09-22 Thread matteo
Victor,

thanks for the super quick reply.

I still don't get how can I select the different single fields from the
output.

I mean, with the selection parameter all is straightforward.

In the example I wrote in the previous mail, how can I access the first
field of the multiple fields parameter?

Thank Victor for your time, if I manage how to do it, I will also
improve the documentation

Cheers

Matteo
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Multiple Fields in R-Processing

2016-09-22 Thread Victor Olaya
Matteo

For the multiple field you dont supply the fields or options. It takes
them from the parent layer and you can select several, instead of one,
as the PArameterTableField does

Hope this helps

2016-09-22 14:48 GMT+02:00 matteo :
> Hi guys,
>
> I have a small problem with the integration of the MultipleField
> parameter in the R-Processing script.
>
> The trial script is super simple:
>
> ##[R-Geostatistics]=group
> ##l=vector
> ##X=multiple Field l
>
>>X
>
> So I just want to understand how can I extract the single fields of the
> parameter.
>
> Doing so the script runs, but I always get the same error:
>
>
>
> Source: "/tmp/processing510ec5d19fc74c0582fbe8983bd85e66", layer:
> "1474548069.5615"
> with 102 features
> It has 6 fields
> multiple Field l="Gruppo;SN"
> Error: unexpected symbol in "multiple Field"
> Execution halted
>
>
> I tried several other combinations but I'm running out of fantasy.
>
> With the selection parameter it is simpler:
>
>
> ##type=selection point;lines;point
>
>>type
>
>
> and the output is 0 (so the first chosen).
>
>
> The parameter can be accessed here:
>
> import processing
> from processing.core.parameters import ParameterTableMultipleFiel
>
>
>
> Thanks guys
>
> Matteo
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer