[GRASS-user] Re: Further on Checking if a point (X,
Y) is inside the, polygons of a shape file using command line
John C. Tull
john.tull at wildnevada.org
Wed Mar 5 18:03:16 EST 2008
On Mar 4, 2008, at 1:08 PM, Moritz Lennert wrote:
> On Tue, March 4, 2008 18:04, John C. Tull wrote:
>> I think your approach with two runs is adequate, although I am not
>> sure which tool you would use to extend your polygon as I have not
>> looked into that issue recently. I have similar questions that I
>> address. In order to get names of the polygons (conservation areas
>> for
>> you), I go beyond v.select to populate a field with the names of the
>> areas being queried. I then dump to a text file that I can open in a
>> spreadsheet application for summarizing. My example assumes you
>> have a
>> field called 'name' in your input polygon file:
>>
>> v.select ainput=in_points binput=conservation_polygons
>> out=points_in_polygons
>> v.db.addcol points_in_polygons col="polygon_name VARCHAR(40)"
>> v.distance from= points_in_polygons to=conservation_polygons dmax=0
>> upload=to_attr to_column=name col=polygon_name
>> v.db.select points_in_polygons > points_in_polygons.txt
>>
>
> Just out of curiosity: do you really need the v.select ? Wouldn't
> this work:
>
> v.db.addcol in_points col="polygon_name VARCHAR(40)"
> v.distance from=in_points to=conservation_polygons dmax=0 /
> upload=to_attr to_column=name col=polygon_name
>
> ?
>
> Moritz
>
I suppose you might be able to do that. I used the v.select to first
subsample a larger dataset to create a file of points that fall within
the polygons. Your approach would append polygon_name to the entire
points file, which may be perfectly suitable for some peoples needs.
Unless I am missing something, a definite possibility.
John
More information about the grass-user
mailing list