[GRASSLIST:3992] Re: intersect sites with polygons?

Radim Blazek blazek at itc.it
Mon Jul 1 07:23:15 EDT 2002


On Friday 28 June 2002 11:45 am, Markus Neteler wrote:
> On Thu, Jun 27, 2002 at 10:57:56AM -0700, Jeff D. Hamann wrote:
> > I would like to intersect a sites layer with a polygon layer to obtain
> > only the polygons that have a site within them... Do I have to convert
> > the sites to a raster/vector layer first?
>
> An (un)useful hint related to this topic:
>
> GRASS lib provides functions for that:
>
> int
> Vect_get_point_in_poly (struct line_pnts *Points, double *X, double *Y)
>
>   get point inside polygon
>
>   This routine finds a suitable area point in the ring described by the
> line struct Points, but without reference to any islands that may be
> present inside the area. This routine is useful where prior topological
>   information on an area is not available.
>
>   The return value is 0 on success, -1 on failure.}
>
>
> (also points in islands etc)
>
> So it *should* be possible to write 'v.points.in.polygon' reading a
> vector points map (eventually generated with s.to.vect) and a
> polygon vector file.
> Maybe we find a volunteer to code that?

As this is one of MANY spatial analysis, it should go to
v.mapcalc (already started) and function available is:
int Vect_point_in_area (struct Map_info *, int, double, double);  
(takes into account islands)
then 
v.mapcalc "selpol =  pol CONTAINS sites"



Radim



More information about the grass-user mailing list