[GRASS-user] Error in v.distance when running from R (in a container)

Veronica Andreo veroandreo at gmail.com
Mon Jul 20 12:22:10 PDT 2020


Hi Mehrdad,

I have the same problem (running just GRASS dev - without calling it from
R).
Why can't v.distance update the current table (I tried using --overwrite
but does not work either)? I do not want to create a new vector or a new
table or print to stdout. Is this an undocumented new behaviour in dev or a
bug? There's indeed an example in the manual page of v.distance that
describes what we want to do; see **Point-in-polygon** example.

Vero

El lun., 20 jul. 2020 a las 6:23, Mehrdad Varedi (<varedi at waterlix.com>)
escribió:

> Hi Markus,
> Sorry I am getting back to a conversation we had more than a month ago. I
> found the error on v.distance in R.
>
> FYI, I run the same program under GRASS 7.8.3 with no problem, although
> when the v.distance function is called from R under GRASS 7.9.dev I get
> the following error:
>
> *"ERROR: At least one of the following options is required: <output>,
> <table> and <-p>>"*
>
> Here is the code I use in R:
>
> execGRASS("v.distance",parameters= list(
>   from = NewLayerName,
>   from_layer = "1",
>   from_type = "point",
>   to = BasePointLayer,
>   to_layer = "1",
>   to_type = "point",
>   dmax = -1,
>   dmin = -1,
>   upload = "to_attr",
>   column = NewRefColumn,
>   to_column = UniqueID2BeTaken,
>   separator = "tab"),
>   flags=c('overwrite','verbose')
> )
>
> I still want to upload the results  to the selected column, not to a new
> table. How can I make it work in GRASS 7.9.dev?
> by the way,  the GRASS 7.8.3 is on my ubuntu computer, while the GRASS
> 7.9.dev is running in a docker container with the same OS.
>
> I would appreciate to learn what should I add exactly to the command to
> make it work with the new version of GRASS. If there is a bug that needs
> some work , probably I should create a new container with the previous
> version of GRASS. what do you recommend?
>
> Kind regards,
>
> Mehrdad
>
>
> On Mon, May 25, 2020 at 5:12 AM Markus Neteler <neteler at osgeo.org> wrote:
>
>> Hi Mehrdad,
>>
>> On Mon, May 25, 2020 at 10:24 AM Mehrdad Varedi <varedi at waterlix.com>
>> wrote:
>> >
>> > Hi Everyone,
>> > I can run the R program with no problem from a Shiny app I have in
>> Rstudio. Although when running the program from a container, I receive an
>> error when running the v.distance and program halts.
>> >
>> > here is the error dump I receive, not so much informative, although I
>> appreciate to know if you have ever seen such an issue: (FYI many other
>> grass functions are executed before this error happens)
>> >
>> > Warning: Error in execGRASS: The command:
>> > v.distance --overwrite --verbose from=WM_End from_layer=1
>> from_type=point to=WM_start to_layer=1 to_type=point dmax=0.5 dmin=-1
>> upload=to_attr column=LinkedWMID to_column=WMAINID separator=tab
>> > produced an error (1) during execution:
>> > Finds the nearest element in vector map 'to' for elements in vector map
>> 'from'.
>> >
>> > Usage:
>> >  v.distance [-pas] from=name [from_layer=string]
>> >    [from_type=string[,string,...]] to=name [to_layer=string]
>> >    [to_type=string[,string,...]] [output=name] [dmax=value] [dmin=value]
>> >    upload=string[,string,...] [column=name[,name,...]] [to_column=name]
>> >    [table=name] [separator=character] [--overwrite] [--help] [--verbose]
>> >    [--quiet] [--ui]
>> >
>> > Flags:
>> >   -p   Print output to stdout, don't update attribute table
>> >   -a   Calculate distances to all features within the threshold
>> >   -s   Print output as square matrix (only possible for one single
>> upload variable)
>> >
>> > Parameters:
>> >         from   Name of existing vector map (from)
>> >   from_layer   Laye [... truncated]
>>
>> ^--- and chance to expand this "truncated"? Exactly therein you will
>> find the error message :-)
>> It is in the last line of the truncated part.
>>
>> Best,
>> Markus
>>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200720/6b100636/attachment.html>


More information about the grass-user mailing list