[GRASS-user] Further on Checking if a point (X, Y) is inside the, polygons of a shape file using command line

Corrado ct529 at york.ac.uk
Tue Mar 4 06:00:30 EST 2008


Dear John, Rick, Hamish,

thanks for your kind answers.

I explain the problem:

I have a file with some hundreds of species and 58,000 observations. For each 
species, I have the coordinates (X,Y) of the sites where they were observed. 

I also have a shape file, with polygons representing conservation areas, like 
natural reserves. 

I need to know for each species, how many point fall inside conservation areas 
and how many points fall outside conservation areas. Also, I need to run the 
same test on the conservation areas with a buffer of 100 m and with a buffer 
of 500 m.

This is what I thought:  I test if each point (that is site) is inside the 
polygon (that is conservation area), and I have an answer like yes or no (or 
0 or 1). I write a routine that does test all the points for each species.

I add the buffer (I do not know how to do it, but I think it is possible). I 
run the test again.

What do you think of this approach? 

If I use v.select, would that return me 0 or 1 (or yes or no), when I try to 
overlap one point with the vector map?

Or do you think it would be better to use R?

Or would it be better to prepare a vector map for each species with all the 
sites, and overlap species by species instead of point by point?

I apologise for my questions, but I am trying to use GRASS for the first time. 
I would like to switch from ArcGIS and convince also the other people in the 
research group (there is at least two of us campaigning now).

Thanks!

On Tuesday 04 March 2008 00:38:26 Hamish wrote:
> Rick Reeves wrote:
> > This is a good task for the R programming environment, which has
> > strong geospatial tools and integrates with GRASS:
>
> FYI, in GRASS's vector library (available outside of C with e.g.
> SWIG-Python) there a number of x-in-polygon functions found in
> lib/vector/Vlib/poly.c. v.buffer uses such a test to check that its
> centroid is inside the new area, you could trace that back if you
> wanted to see the method in use.
>
> from GRASS modules there is v.select and 'v.distance dmax=0' (?) and
> probably other ways too.
>
>
> many roads,
> Hamish
>
>
>
>      
> ___________________________________________________________________________
>_________ Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now. 
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


Best Regards
-- 
Corrado Topi

Global Climate Change and Biodiversity
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk


More information about the grass-user mailing list