creating a grid from a contour vector shape

3 messages Options
Embed this post
Permalink
Alexandre VILLERS

creating a grid from a contour vector shape

Reply Threaded More More options
Print post
Permalink
Good evening,

I'm a beginner with GRASS. In order to analyse a dataset on the spatial distribution of a bird's species, I wanted to create many spatial grids (with increasing cell size, from 500 to 15000 meters)and then count birds in each cell.

I started with
v.in.ogr to import a countour shape file for my observation window
v.to.rast (countour)followed by r.mask to limit the work on that contour limit
finally, v.mkgrid to create the grid with the required spatial resolution.

I'm looping this with R and also added 10 different origins (lower left corner of grids) in order to average counts, specially for large grids.

The next step is to overlay within R, using the sp packages, the layer of points and the grid. The problem (which, by taking the time of reflexion, would have been clear before running the script !) is that some grid cells are cut many times by the countour vector, leading to unique cells having many different IDs (which I didn't want).

So can I overlay that contour vector on a grid while keeping the cells (intact) intersected by the countour limit (instead of clipping them) ?

Hope I was clear enough...

Best regards

Alex
Alexandre Villers
PhD. Student
Team Biodiversity
CEBC CNRS
79360 Beauvoir sur Niort


__________ Information from ESET Mail Security, version of virus signature database 4398 (20090905) __________

The message was checked by ESET Mail Security.
http://www.eset.com


_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats
Mauricio Zambrano

Re: creating a grid from a contour vector shape

Reply Threaded More More options
Print post
Permalink
Hi Alex,

Did you try the commands 'spsample' in R ?

For creating the grid form the shapefile, you can try something like:

yourgrid <- spsample(yourshafilename.shp, type="regular",
cellsize=yourcellsize, offset = c(0.5, 0.5))

I hope this helps.

Kinds,

Mauricio
--
Linux user  #454569 -- Ubuntu user #17469

2009/9/5 alexandre villers <[hidden email]>:

> Good evening,
>
> I'm a beginner with GRASS. In order to analyse a dataset on the spatial distribution of a bird's species, I wanted to create many spatial grids (with increasing cell size, from 500 to 15000 meters)and then count birds in each cell.
>
> I started with
> v.in.ogr to import a countour shape file for my observation window
> v.to.rast (countour)followed by r.mask to limit the work on that contour limit
> finally, v.mkgrid to create the grid with the required spatial resolution.
>
> I'm looping this with R and also added 10 different origins (lower left corner of grids) in order to average counts, specially for large grids.
>
> The next step is to overlay within R, using the sp packages, the layer of points and the grid. The problem (which, by taking the time of reflexion, would have been clear before running the script !) is that some grid cells are cut many times by the countour vector, leading to unique cells having many different IDs (which I didn't want).
>
> So can I overlay that contour vector on a grid while keeping the cells (intact) intersected by the countour limit (instead of clipping them) ?
>
> Hope I was clear enough...
>
> Best regards
>
> Alex
> Alexandre Villers
> PhD. Student
> Team Biodiversity
> CEBC CNRS
> 79360 Beauvoir sur Niort
>
>
> __________ Information from ESET Mail Security, version of virus signature database 4398 (20090905) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>
> _______________________________________________
> grass-stats mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>
_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats
Markus Neteler

Re: creating a grid from a contour vector shape

Reply Threaded More More options
Print post
Permalink
In reply to this post by Alexandre VILLERS
Hi Alexandre,

On Sat, Sep 5, 2009 at 10:29 PM, alexandre
villers<[hidden email]> wrote:
> Good evening,
>
> I'm a beginner with GRASS. In order to analyse a dataset on the spatial distribution of a bird's species, I wanted to create many spatial grids (with increasing cell size, from 500 to 15000 meters)and then count birds in each cell.
>
> I started with
> v.in.ogr to import a countour shape file for my observation window
> v.to.rast (countour)followed by r.mask to limit the work on that contour limit
> finally, v.mkgrid to create the grid with the required spatial resolution.

>From your personal email I understand that "contours" are meant
here as boundaries of the study area.

Would this approach work?
http://grass.osgeo.org/wiki/Count_points_in_polygon

Best regards
Markus
_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats