2

My goal is to select a specific polygon in which the user clicked and make a new vector map that contains only the selected polygon. I see two ways:

  1. Convert XY coordinate from literal input to a vector point map and use v.select. But I can not find a command (or a workaround) for the first part?
  2. Use v.what (XY from literal input) to see which polygon is located at this point and use ID information in v.extract command as binded variable with SQL where query. But how to store/use for example, "ID" data (printed in shell script style output from v.what) as global variable?

Also, the idea is first to use standard GRASS modules with cmd.

1

On a unix system you should be able to store the output like that:

export VAR=`v.what [-dag] map=name[,name,...]` 
echo $VAR

On a Windows Shell its kind of annoying but it suppose to work with:

set VAR="v.what [-dag] map=name[,name,...]"
echo %VAR%

Basically it depends on the correct use of your shell, correct me if I'm wrong.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.