[GRASS-user] [vector attribute query]

Ang Sherpa angsherpa232 at gmail.com
Thu Mar 16 21:30:16 PDT 2017


Thanks, it worked.

*Regards,*
*Ang Dawa Sherpa*
*GIS technician - Irrigation Master Plan*
*WRPPF - DOI, Nepal Government*
*Lalitpur*
*contact: 984 007 3861*

On Thu, Mar 16, 2017 at 6:22 PM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:

> On 16/03/17 12:36, Ang Sherpa wrote:
>
>> Hello users,
>>
>> Is it possible to query according to coordinates and return the value of
>> desired column from attribute table as result.
>>
>> v.what allows to query the map, however, could not figure out how to
>> choose the column in attribute table.
>>
>> Eg. In a world shape file  having "population" as one of its column in
>> attribute table.
>> when 25.36258,85.236554 is entered in coordinates then it should return
>> the population of that country in which the given coordinates belongs to.
>>
>> Any help will be much appreciated.
>>
>
> It depends on the language in which you are working.
>
> In a bash shell, using the NC demo dataset, here's how you can get the
> name of a specific county which is in the NAME column of the attribute
> table:
>
> eval $(v.what -ga boundary_county coordinates=498364.930178,229163.426556)
> echo $NAME
>
> In python, you can use parse_command to get a dictionary of results:
>
> result = gscript.parse_command('v.what', flags='ga',
> map='boundary_county', coordinates=[498364.930178,229163.426556])
> result['NAME']
>
> Moritz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170317/aec3a71b/attachment-0001.html>


More information about the grass-user mailing list