[GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-27 Thread daljeet

Hi,

I have the point rainfall data of a region. Few of the point data are
outside the region of interest.

I am making the voronoi polygons using the v.voronoi on the vector imported
from this point ascii (x,y,z) data.

The polygon may be fully inside the region of interest or may be partially
outside the region of interest.

In case of the polygon which is partially outside the region of interest,
the area which is inside the region of interest need to be calculated. How
to calculate this?

How can i calculate the area of voronoi polygon.

Thanks in advance.
Daljeet
-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3335923.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread Moritz Lennert

On 27/07/09 21:38, daljeet wrote:

Hi,

I have the point rainfall data of a region. Few of the point data are
outside the region of interest.

I am making the voronoi polygons using the v.voronoi on the vector imported
from this point ascii (x,y,z) data.

The polygon may be fully inside the region of interest or may be partially
outside the region of interest.

In case of the polygon which is partially outside the region of interest,
the area which is inside the region of interest need to be calculated. How
to calculate this?


- Define region of interest with g.region.
- Create polygon of region with v.in.region.
- Overlay voronoi polygons with region polygon with v.overlay operator=AND


How can i calculate the area of voronoi polygon.


v.report or v.to.db

Moritz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread daljeet

Thanks Moritz.

I was wrongly using the term "region" in my question above. The requirement
is slightly different. Let me explain you in detail.

Inputs:
1. I have got the shapefile data of the country. I imported it using
v.in.ogr and extracted (v.extract) the vector of the desired "State" using
the "where" clause on the attribute which contains the name of the States.
So, this means i have the vector of a particular State and its area is
available using v.report.

2. I have also got the rainfall point data for the entire country in the
ascii file (x,y,z) for one week (z being the amount of rainfall)

Output required:
The volume of rainfall in the particular State (which is extracted above).

What I am doing:
I wanted to apply both, the Thiessen polygon and the Isohyetal Method to
calculate the volume  of rainfall.

Till now I am only working on Thiessen, and this is what i have done:
1. Imported the ascii rainfall point data (v.in.ascii) in the vector. This
is the vector for the whole country.
2. Created the voronoi vector on the above rainfall vector (v.voronoi)
3. Overlaid the voronoi rainfall vector of the country (from step 2) on the
extracted vector of the State (from input 1 above) with AND operator.

To verify, the sum of "area of each polygon" on the overlaid vector should
be same as area of the extracted State vector.

But this is not coming out to be same. The area of the voronoi overlaid map
is smaller than the area of the extracted shape of State.  One observation,
the voronoi overlaid map shows some white grids (both inside and at the
boundary of the map) and I suspect if these are being taken into account for
the area. Attached is the png image of the overlaid vectors. 

http://n2.nabble.com/file/n3342895/rainfall_theissen_png.png 

Any idea what could be my mistake. What I am doing which is making the loss
of area in the case of polygons.

Thanks
daljeet


Moritz Lennert wrote:
> 
> On 27/07/09 21:38, daljeet wrote:
>> Hi,
>> 
>> I have the point rainfall data of a region. Few of the point data are
>> outside the region of interest.
>> 
>> I am making the voronoi polygons using the v.voronoi on the vector
>> imported
>> from this point ascii (x,y,z) data.
>> 
>> The polygon may be fully inside the region of interest or may be
>> partially
>> outside the region of interest.
>> 
>> In case of the polygon which is partially outside the region of interest,
>> the area which is inside the region of interest need to be calculated.
>> How
>> to calculate this?
> 
> - Define region of interest with g.region.
> - Create polygon of region with v.in.region.
> - Overlay voronoi polygons with region polygon with v.overlay operator=AND
> 
>> How can i calculate the area of voronoi polygon.
> 
> v.report or v.to.db
> 
> Moritz
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3342895.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread Moritz Lennert

On 28/07/09 16:02, daljeet wrote:

Thanks Moritz.

I was wrongly using the term "region" in my question above. The requirement
is slightly different. Let me explain you in detail.

Inputs:
1. I have got the shapefile data of the country. I imported it using
v.in.ogr and extracted (v.extract) the vector of the desired "State" using
the "where" clause on the attribute which contains the name of the States.
So, this means i have the vector of a particular State and its area is
available using v.report.

2. I have also got the rainfall point data for the entire country in the
ascii file (x,y,z) for one week (z being the amount of rainfall)

Output required:
The volume of rainfall in the particular State (which is extracted above).

What I am doing:
I wanted to apply both, the Thiessen polygon and the Isohyetal Method to
calculate the volume  of rainfall.

Till now I am only working on Thiessen, and this is what i have done:
1. Imported the ascii rainfall point data (v.in.ascii) in the vector. This
is the vector for the whole country.
2. Created the voronoi vector on the above rainfall vector (v.voronoi)
3. Overlaid the voronoi rainfall vector of the country (from step 2) on the
extracted vector of the State (from input 1 above) with AND operator.

To verify, the sum of "area of each polygon" on the overlaid vector should
be same as area of the extracted State vector.

But this is not coming out to be same. The area of the voronoi overlaid map
is smaller than the area of the extracted shape of State.  One observation,
the voronoi overlaid map shows some white grids (both inside and at the
boundary of the map) and I suspect if these are being taken into account for
the area. Attached is the png image of the overlaid vectors. 

http://n2.nabble.com/file/n3342895/rainfall_theissen_png.png 


Any idea what could be my mistake. What I am doing which is making the loss
of area in the case of polygons.


Sorry, cannot help you as such. Start by giving the exact command lines 
used with each command. Also show the results of v.voronoi. And how did 
you calculate the areas ?


Moritz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread daljeet

Hi Moritz,

I am new to GRASS and the basic concepts of this field. Below, I tried my
best to share all the information. Please write if I have missed anything.

List of commands issued in sequence:

//import of shapefile data of country
v.in.ogr -e dsn="IND_adm2.shp" output="Ind_adm2_v" min_area=0.0001 snap=-1

//extract the desired State (in my case it is the state of Kerala)
v.extract input=Ind_adm2_v output=Ind_adm2_ker new=1 where="(Name_1 =
'Kerala')"

//set to region to the vector created for the State
g.region vect=Ind_adm2_ker

//displays as
d.vect Ind_adm2_ker

http://n2.nabble.com/file/n3344342/Ind_adm2_ker.png 

//area of Kerala state
v.report Ind_adm2_ker option=area units=k
cat|area
1|37700.7050169835

//import of rainfall data of the country for a week (available in ascii
format)
v.in.ascii
input="/home/daljeet/grassdata/India_Data_From_DST/india_rain_orig.txt"
output="Ind_rain_orig" format="point" fs="\t" skip=1 columns="x double
precision, y double precision, rain_info double precision" x=2 y=1 z=0 cat=0

//creating the voronoi
v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"

//display the voronoi
d.vect "Ind_rain_ker_vor"

http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 

//overlay
v.overlay ainput="Ind_adm2_ker" atype="area" alayer=1
binput="Ind_rain_ker_vor" btype="area" blayer=1 output="ker_rain_vor_over"
operator="and" olayer=1,0,0

//show the overlaid vector 
d.vect ker_rain_vor_over

http://n2.nabble.com/file/n3344342/ker_rain_vor_over.png 

//storing the area of each polygon to a csv file
v.report ker_rain_vor_over option=area units=k >ker_area.csv --o

attached is the csv file ker_area.csv

http://n2.nabble.com/file/n3344342/ker_area.csv ker_area.csv 

Sum of the area of polygon in the last column is 23881.22 (which is not
equal to the one which is calculated above for Kerala Stata, 
37700.7050169835)

Thanks
Daljeet


Moritz Lennert wrote:
> 
> On 28/07/09 16:02, daljeet wrote:
>> Thanks Moritz.
>> 
>> I was wrongly using the term "region" in my question above. The
>> requirement
>> is slightly different. Let me explain you in detail.
>> 
>> Inputs:
>> 1. I have got the shapefile data of the country. I imported it using
>> v.in.ogr and extracted (v.extract) the vector of the desired "State"
>> using
>> the "where" clause on the attribute which contains the name of the
>> States.
>> So, this means i have the vector of a particular State and its area is
>> available using v.report.
>> 
>> 2. I have also got the rainfall point data for the entire country in the
>> ascii file (x,y,z) for one week (z being the amount of rainfall)
>> 
>> Output required:
>> The volume of rainfall in the particular State (which is extracted
>> above).
>> 
>> What I am doing:
>> I wanted to apply both, the Thiessen polygon and the Isohyetal Method to
>> calculate the volume  of rainfall.
>> 
>> Till now I am only working on Thiessen, and this is what i have done:
>> 1. Imported the ascii rainfall point data (v.in.ascii) in the vector.
>> This
>> is the vector for the whole country.
>> 2. Created the voronoi vector on the above rainfall vector (v.voronoi)
>> 3. Overlaid the voronoi rainfall vector of the country (from step 2) on
>> the
>> extracted vector of the State (from input 1 above) with AND operator.
>> 
>> To verify, the sum of "area of each polygon" on the overlaid vector
>> should
>> be same as area of the extracted State vector.
>> 
>> But this is not coming out to be same. The area of the voronoi overlaid
>> map
>> is smaller than the area of the extracted shape of State.  One
>> observation,
>> the voronoi overlaid map shows some white grids (both inside and at the
>> boundary of the map) and I suspect if these are being taken into account
>> for
>> the area. Attached is the png image of the overlaid vectors. 
>> 
>> http://n2.nabble.com/file/n3342895/rainfall_theissen_png.png 
>> 
>> Any idea what could be my mistake. What I am doing which is making the
>> loss
>> of area in the case of polygons.
> 
> Sorry, cannot help you as such. Start by giving the exact command lines 
> used with each command. Also show the results of v.voronoi. And how did 
> you calculate the areas ?
> 
> Moritz
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3344342.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread Moritz Lennert

On 28/07/09 18:42, daljeet wrote:

Hi Moritz,

I am new to GRASS and the basic concepts of this field. Below, I tried my
best to share all the information. Please write if I have missed anything.


This is perfect, thanks !


//creating the voronoi
v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"

//display the voronoi
d.vect "Ind_rain_ker_vor"

http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 



The problem is here, with v.voronoi, as you can see the white spots 
here. What do the original points (Ind_rain_orig) look like ?


I don't know the module well enough, but I think you might have hit a 
bug there (I've just tried a simple example for myself and also get 
weird white spots). Please file a report in the bug tracker.





//storing the area of each polygon to a csv file
v.report ker_rain_vor_over option=area units=k >ker_area.csv --o


Note that you can use v.addcol and v.to.db upload the polygon areas to 
the attribute table.


Moritz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user



Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread daljeet

These white spots in the voronoi vector may be the cause. But i ran the
voronoi module on the "archsites" vector of the Spearfish60 dataset and its
runs fine. The cmd was

v.voronoi input="archsites" output="arch_voronoi"

The only difference is that the region of archsites has got less points 
(around 25) whereas in Ind_rain_orig the total points were 93,000. Can this
be an issue. Can you test the module at your end with less and huge data
points and see if you also get similar results in both the cases. This would
be a great help. 

Also, i checked and the data of rain fall on voronoi vector is NOT NULL on
these white spots (checked using v.what.vect).

//d.vect Ind_rain_orig
//The  Ind_rain_orig looks like this - when the region is set to vector of
Kerala
//g.region vect=ker_rain_v

http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_ker.png 

But when the region is set to Ind_adm2_v (whole  country) the image is like 
//g.region vect=Ind_adm2_v
//d.vect Ind_rain_orig

http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_adm2.png 

Thanks
Daljeet

Moritz Lennert wrote:
> 
> On 28/07/09 18:42, daljeet wrote:
>> Hi Moritz,
>> 
>> I am new to GRASS and the basic concepts of this field. Below, I tried my
>> best to share all the information. Please write if I have missed
>> anything.
> 
> This is perfect, thanks !
> 
>> //creating the voronoi
>> v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"
>> 
>> //display the voronoi
>> d.vect "Ind_rain_ker_vor"
>> 
>> http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 
>> 
> 
> The problem is here, with v.voronoi, as you can see the white spots 
> here. What do the original points (Ind_rain_orig) look like ?
> 
> I don't know the module well enough, but I think you might have hit a 
> bug there (I've just tried a simple example for myself and also get 
> weird white spots). Please file a report in the bug tracker.
> 
> 
>> 
>> //storing the area of each polygon to a csv file
>> v.report ker_rain_vor_over option=area units=k >ker_area.csv --o
> 
> Note that you can use v.addcol and v.to.db upload the polygon areas to 
> the attribute table.
> 
> Moritz
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3345107.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread daljeet

http://www.intevation.de/rt/webrt?serial_num=4292&display=History

The problem that we are facing may be related to above issue.

Thanks
Daljeet 
 

daljeet wrote:
> 
> These white spots in the voronoi vector may be the cause. But i ran the
> voronoi module on the "archsites" vector of the Spearfish60 dataset and
> its runs fine. The cmd was
> 
> v.voronoi input="archsites" output="arch_voronoi"
> 
> The only difference is that the region of archsites has got less points 
> (around 25) whereas in Ind_rain_orig the total points were 93,000. Can
> this be an issue. Can you test the module at your end with less and huge
> data points and see if you also get similar results in both the cases.
> This would be a great help. 
> 
> Also, i checked and the data of rain fall on voronoi vector is NOT NULL on
> these white spots (checked using v.what.vect).
> 
> //d.vect Ind_rain_orig
> //The  Ind_rain_orig looks like this - when the region is set to vector of
> Kerala
> //g.region vect=ker_rain_v
> 
>  http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_ker.png 
> 
> But when the region is set to Ind_adm2_v (whole  country) the image is
> like 
> //g.region vect=Ind_adm2_v
> //d.vect Ind_rain_orig
> 
>  http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_adm2.png 
> 
> Thanks
> Daljeet
> 
> Moritz Lennert wrote:
>> 
>> On 28/07/09 18:42, daljeet wrote:
>>> Hi Moritz,
>>> 
>>> I am new to GRASS and the basic concepts of this field. Below, I tried
>>> my
>>> best to share all the information. Please write if I have missed
>>> anything.
>> 
>> This is perfect, thanks !
>> 
>>> //creating the voronoi
>>> v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"
>>> 
>>> //display the voronoi
>>> d.vect "Ind_rain_ker_vor"
>>> 
>>> http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 
>>> 
>> 
>> The problem is here, with v.voronoi, as you can see the white spots 
>> here. What do the original points (Ind_rain_orig) look like ?
>> 
>> I don't know the module well enough, but I think you might have hit a 
>> bug there (I've just tried a simple example for myself and also get 
>> weird white spots). Please file a report in the bug tracker.
>> 
>> 
>>> 
>>> //storing the area of each polygon to a csv file
>>> v.report ker_rain_vor_over option=area units=k >ker_area.csv --o
>> 
>> Note that you can use v.addcol and v.to.db upload the polygon areas to 
>> the attribute table.
>> 
>> Moritz
>> ___
>> grass-user mailing list
>> grass-user@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3345998.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-07-28 Thread Micha Silver
On Tue, 28 Jul 2009 11:24:19 -0700 (PDT)
daljeet  wrote:

> 
> 
> 
> //d.vect Ind_rain_orig
> //The  Ind_rain_orig looks like this - when the region is set to
> vector of Kerala
> //g.region vect=ker_rain_v
> 
> http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_ker.png 
> 
> But when the region is set to Ind_adm2_v (whole  country) the image
> is like //g.region vect=Ind_adm2_v
> //d.vect Ind_rain_orig
> 
> http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_adm2.png 
> 

Since you seem to have a rigid matrix of data points, what's the
purpose of the voronoi polygons??
Can't you just run v.surf.rst to get a rain_info raster surface, then
r.contour to make your isohyetal lines? Finallly v.rast.stats will add
columns to the vector table with all the rainfall statistics.


 
> Thanks
> Daljeet
> 
> Moritz Lennert wrote:
> > 
> > On 28/07/09 18:42, daljeet wrote:
> >> Hi Moritz,
> >> 
> >> I am new to GRASS and the basic concepts of this field. Below, I
> >> tried my best to share all the information. Please write if I have
> >> missed anything.
> > 
> > This is perfect, thanks !
> > 
> >> //creating the voronoi
> >> v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"
> >> 
> >> //display the voronoi
> >> d.vect "Ind_rain_ker_vor"
> >> 
> >> http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 
> >> 
> > 
> > The problem is here, with v.voronoi, as you can see the white spots 
> > here. What do the original points (Ind_rain_orig) look like ?
> > 
> > I don't know the module well enough, but I think you might have hit
> > a bug there (I've just tried a simple example for myself and also
> > get weird white spots). Please file a report in the bug tracker.
> > 
> > 
> >> 
> >> //storing the area of each polygon to a csv file
> >> v.report ker_rain_vor_over option=area units=k >ker_area.csv --o
> > 
> > Note that you can use v.addcol and v.to.db upload the polygon areas
> > to the attribute table.
> > 
> > Moritz
> > ___
> > grass-user mailing list
> > grass-user@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/grass-user
> > 
> > 
> 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-08-31 Thread daljeet

Hi Micha,

I could create isohyetal lines using the suggested steps:

-v.in.ascii
v.in.ascii x=2 y=1 cat=0 input="01_08nov2001" out="rainvector" columns="x
double precision, y double precision, rain_info double precision" --o
fs="\t" skip=1

- set the region to smaller vector and set the mask created from the same
smaller region vector- this is to reduce the computation and work on smaller
region.

-v.surf.rst (without playing around with tension and smooothness)
v.surf.rst rainvector zcol=rain_info elev=rainraster --o

-r.contour
r.contour step=10 input=rainraster output=rainvector_con

-v.rast.stats
v.rast.stats rainvector_con raster=rainraster colprefix=pre

The generated image is like this
http://n2.nabble.com/file/n3555804/rainvector_con.png 

Following are the doubts/questions

1. I saw the details of the raster created from v.surf.rst

>r.info rainraster

zmin_data=0.00, zmax_data=141.322000|
zmin_int=-13.588332, zmax_int=52.589905 

zmin_data and zmax_data seems to be correct but I do not understand 
a) why the interpolated value zmin_int=-13.588332 is -ve
b) and what is meaning of zmax_int equal to  52.589905

2. The target is to be able to calculate the area between two isohyetal
lines and multiplying that area with the average rainfall within the two
isohyets. This is to be done for all isohyetal lines. 

Average can be calculated by averaging the value of rainfall of the two
isohyetal lines.

But how to calculate the area b/w the two isohyetal lines?

>v.db.select rainvector_con
cat|level|pre_n|pre_min|pre_max|pre_range|pre_mean|pre_stddev|pre_varian|pre_cf_var|pre_sum
1|0|722|-7.148755|1.627629|8.776384|-0.028756|0.424996|0.180621|-1477.946779|-20.761703
2|10|820|0.515458|13.074255|12.558797|10.01766|0.67391|0.454155|6.727224|8214.481322
3|20|557|10.988949|23.001575|12.012627|19.92515|0.938034|0.879908|4.707789|11098.308486
4|30|341|19.780724|33.184017|13.403294|29.949896|1.289828|1.663655|4.306618|10212.914476
5|40|168|31.07769|42.131256|11.053566|39.848495|1.331978|1.774164|3.342605|6694.547157
6|50|13|44.652187|52.589905|7.937717|49.761042|1.654373|2.73695|3.324635|646.893547


Thanks
Daljeet


Micha Silver wrote:
> 
> On Tue, 28 Jul 2009 11:24:19 -0700 (PDT)
> daljeet  wrote:
> 
>> 
>> 
>> 
>> //d.vect Ind_rain_orig
>> //The  Ind_rain_orig looks like this - when the region is set to
>> vector of Kerala
>> //g.region vect=ker_rain_v
>> 
>> http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_ker.png 
>> 
>> But when the region is set to Ind_adm2_v (whole  country) the image
>> is like //g.region vect=Ind_adm2_v
>> //d.vect Ind_rain_orig
>> 
>> http://n2.nabble.com/file/n3345107/Ind_rain_orig_reg_adm2.png 
>> 
> 
> Since you seem to have a rigid matrix of data points, what's the
> purpose of the voronoi polygons??
> Can't you just run v.surf.rst to get a rain_info raster surface, then
> r.contour to make your isohyetal lines? Finallly v.rast.stats will add
> columns to the vector table with all the rainfall statistics.
> 
> 
>  
>> Thanks
>> Daljeet
>> 
>> Moritz Lennert wrote:
>> > 
>> > On 28/07/09 18:42, daljeet wrote:
>> >> Hi Moritz,
>> >> 
>> >> I am new to GRASS and the basic concepts of this field. Below, I
>> >> tried my best to share all the information. Please write if I have
>> >> missed anything.
>> > 
>> > This is perfect, thanks !
>> > 
>> >> //creating the voronoi
>> >> v.voronoi input="Ind_rain_orig" output="Ind_rain_ker_vor"
>> >> 
>> >> //display the voronoi
>> >> d.vect "Ind_rain_ker_vor"
>> >> 
>> >> http://n2.nabble.com/file/n3344342/Ind_rain_ker_vor.png 
>> >> 
>> > 
>> > The problem is here, with v.voronoi, as you can see the white spots 
>> > here. What do the original points (Ind_rain_orig) look like ?
>> > 
>> > I don't know the module well enough, but I think you might have hit
>> > a bug there (I've just tried a simple example for myself and also
>> > get weird white spots). Please file a report in the bug tracker.
>> > 
>> > 
>> >> 
>> >> //storing the area of each polygon to a csv file
>> >> v.report ker_rain_vor_over option=area units=k >ker_area.csv --o
>> > 
>> > Note that you can use v.addcol and v.to.db upload the polygon areas
>> > to the attribute table.
>> > 
>> > Moritz
>> > ___
>> > grass-user mailing list
>> > grass-user@lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/grass-user
>> > 
>> > 
>> 
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/how-to-calculate-area-of-voronoi-polygons-considering-the-boundary-of-the-catchment-tp3335923p3555804.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-08-31 Thread Micha Silver

Hi Daljeet


daljeet wrote:


Hi Micha,

I could create isohyetal lines using the suggested steps:

  

... clipped...


Following are the doubts/questions

1. I saw the details of the raster created from v.surf.rst

  

r.info rainraster



zmin_data=0.00, zmax_data=141.322000|
zmin_int=-13.588332, zmax_int=52.589905 

zmin_data and zmax_data seems to be correct but I do not understand 
a) why the interpolated value zmin_int=-13.588332 is -ve

b) and what is meaning of zmax_int equal to  52.58990
  
If I understand correctly, the zmax_int and zmin_int are the max and min 
displacements of the interpolated values vs. the actual data points. The 
RST method creates an interpolation which does not usually go thru the 
actual data points, but rather "smooths" over them. These numbers show 
the drift above and below actual data points. So you have one point 
where the interpolated rainfall is 13 mm (or whatever the rain units 
are) below the actual data, and one point where the interpolation is 52 
mm above.

2. The target is to be able to calculate the area between two isohyetal
lines and multiplying that area with the average rainfall within the two
isohyets. This is to be done for all isohyetal lines. 


Average can be calculated by averaging the value of rainfall of the two
isohyetal lines.

But how to calculate the area b/w the two isohyetal lines?
  

Well I can think of two approaches to this.
1- Using vectors:  You might try to convert the isolines to closed 
boundaries, then add centroids and find some way to get the rainfall 
values into the centroids. This would require first to create an "edge" 
line all around the region (v.in.region will do this) to close the ends 
of the isolines,  then run v.clean with the "break" tool to get nodes 
where each contour line crosses this region line. Then you should be 
able to convert the lines to closed boundaries (v.type) and finally 
v.centroids to create centroids in each of the resulting strips between 
isohyetal lines.


But this procedure looks way to convoluted to me. Instead maybe you 
could try:
2- Using rasters:  You already have the rainfall raster. Perhaps create 
a reclass raster map of the rainfall raster using discrete values 
instead of the continuous range. So your reclass rules would look 
something like:

0 thru 20 = 10
21 thru 40 = 30
41 thru 60 = 50
...
This will group together all values in the interval between 0-20 and 
give them the value midway between, etc. Then you could do r.to.vect 
fea=area to create a vector map, and finally v.db.addtable and v.to.db 
to get the areas of each strip into the vector attribute table. (Note 
that r.reclass requires an integer raster)


After that long-winded response, I should add one more comment: Rainfall 
is not a continuous phenomena across a geographic area. There's no 
reason to expect that between the 40 mm line and the 60 mm line the 
average rainfall is 50 mm. If you stay with the original, continuous 
rainfall raster, and use v.rast.stats then the statistics are totalled 
on a cell by cell basis, and you avoid the "unnatural" results that 
might pop up when forcing the data into a framework of arbitrary intervals.


Regards,
Micha
  


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-09-02 Thread daljeet

Thanks.

I am using the first method that you suggested. But it fails to create
centroids whereas there are multiple isohyetal strips now and each should
have been given the centroid. To give you the details on what i did.

In real scenario, we will have the defined catchment area (which will be a
close polygon shaped vector) with rainfall measurements on various gauge
points (some gauge points will be within the catchment boundary and some
will be outside that catchment area, but within the region of the catchment
vector). Please correct me if I am wrong.

I am simulating the above scenario by
a) making a xyz point data file. x,y being lat and long and z being the
measurement of rainfall.
b) catchment is represented by a vector (basin_v)

> g.region vect=basin_v

#import the xyz pt data
> v.in.ascii x=2 y=1 cat=0 input="rain_data" out="rainpoint_v" columns="x
> double precision, y double precision, rain_info double precision" fs="\t"
> skip=1 --o

>MASK applied (which represents the raster of the catchment area with each
cell value equal to 1) 

>v.surf.rst rainpoint_v zcol=rain_info elev=rain_rst --o

>r.contour step=1 input=rain_rst output=rain_con_v

At this stage, i have two seperate vectors, a) contour vector (rain_con_v)
which has the lines only b) vector representing the catchment area (basin_v)
whose topo details are as follows

>v.info rain_con_v -t
nodes=7
points=0
lines=7
boundaries=0
centroids=0
areas=0
islands=0
faces=0
kernels=0
primitives=7
map3d=1

Please note the below output. This may be reason of failure.
>v.info basin_v -t
nodes=2
points=0
lines=0
boundaries=1
centroids=1
areas=1
islands=1
faces=0
kernels=0
primitives=2
map3d=0

Now, as you suggested, i need to apply the v.clean (with break) to create
the nodes at the intersection of isolines and boundary of the catchment
vector.

And for the input of v.clean, I patched the above two vectors using v.patch.
Please correct if this is the right step or something else would have been
done?

> v.patch input=rain_con_v,basin_v out=rain_comp_v
WARNING: Vector map  already exists and will be overwritten
Patching vector map ...
Patching vector map ...
Building topology for vector map ...
Registering primitives...
9 primitives registered
3643 vertices registered
Building areas...
 100%
1 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 9
Number of primitives: 9
Number of points: 0
Number of lines: 7
Number of boundaries: 1
Number of centroids: 1
Number of areas: 1
Number of isles: 1
Intersections at borders will have to be snapped
Lines common between files will have to be edited
The header information also may have to be edited
v.patch complete. 2 vector maps patched

rain_comp_v looks like this

http://n2.nabble.com/file/n3568825/rain_comp_v.png 

> v.clean in=rain_comp_v out=rain_comp tool=break --o
--
Tool: Threshold
Break: 0.00e+00
--
WARNING: Vector map  already exists and will be overwritten
Copying vector lines...
Rebuilding parts of topology...
Building topology for vector map ...
Registering primitives...
9 primitives registered
3643 vertices registered
Number of nodes: 9
Number of primitives: 9
Number of points: 0
Number of lines: 7
Number of boundaries: 1
Number of centroids: 1
Number of areas: -
Number of isles: -
--
Tool: Break lines at intersections
--
Rebuilding topology for output vector map...
Building topology for vector map ...
Registering primitives...
28 primitives registered
3662 vertices registered
Building areas...
 100%
1 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 28
Number of primitives: 28
Number of points: 0
Number of lines: 26
Number of boundaries: 1
Number of centroids: 1
Number of areas: 1
Number of isles: 1

>v.centroids rain_comp out=rain_cen option=add --o
WARNING: Vector map  already exists and will be overwritten
Processing features...
0 new centroids placed in output map
Copying attribute table(s)...
Building topology for vector map ...
Registering primitives...
28 primitives registered
3662 vertices registered
Building areas...
 100%
1 areas built
1 isles built
Attaching islands...
 100%
Attaching centroids...
 100%
Number of nodes: 28
Number of primitives: 28
Number of points: 0
Number of lines: 26
Number of boundaries: 1
Number of centroids: 1
Number of areas: 1
Number of isles: 1
v.category complete. 0 features modified.

Area is still 1 and centroid is 1. If i have understood it correctly, then
we should have multiple area representing the isohyetal strips as output.

Thanks
Daljeet


Micha Silver wrote:
> 
> Hi Daljeet
> 
> 
> daljeet wrote:
> 
>> Hi Micha,
>>
>> I could create isohyetal lines using the suggested steps:
>>
>>   
> ... clipped...
>>
>> Following are the doubts/questions
>>
>> 1. I saw the 

Re: [GRASS-user] how to calculate area of voronoi polygons considering the boundary of the catchment

2009-09-04 Thread daljeet

The issue was that the contours vector was 3d. Now i could put the centroids
and add the area within the boundaries.

I am struck at how to associate the area (cat|area) with the associated
isohyetal lines? Any idea.

Thanks
Daljeet 


daljeet wrote:
> 
> Thanks.
> 
> I am using the first method that you suggested. But it fails to create
> centroids whereas there are multiple isohyetal strips now and each should
> have been given the centroid. To give you the details on what i did.
> 
> In real scenario, we will have the defined catchment area (which will be a
> close polygon shaped vector) with rainfall measurements on various gauge
> points (some gauge points will be within the catchment boundary and some
> will be outside that catchment area, but within the region of the
> catchment vector). Please correct me if I am wrong.
> 
> I am simulating the above scenario by
> a) making a xyz point data file. x,y being lat and long and z being the
> measurement of rainfall.
> b) catchment is represented by a vector (basin_v)
> 
>> g.region vect=basin_v
> 
> #import the xyz pt data
>> v.in.ascii x=2 y=1 cat=0 input="rain_data" out="rainpoint_v" columns="x
>> double precision, y double precision, rain_info double precision" fs="\t"
>> skip=1 --o
> 
>>MASK applied (which represents the raster of the catchment area with each
cell value equal to 1) 
> 
>>v.surf.rst rainpoint_v zcol=rain_info elev=rain_rst --o
> 
>>r.contour step=1 input=rain_rst output=rain_con_v
> 
> At this stage, i have two seperate vectors, a) contour vector (rain_con_v)
> which has the lines only b) vector representing the catchment area
> (basin_v) whose topo details are as follows
> 
>>v.info rain_con_v -t
> nodes=7
> points=0
> lines=7
> boundaries=0
> centroids=0
> areas=0
> islands=0
> faces=0
> kernels=0
> primitives=7
> map3d=1
> 
> Please note the below output. This may be reason of failure.
>>v.info basin_v -t
> nodes=2
> points=0
> lines=0
> boundaries=1
> centroids=1
> areas=1
> islands=1
> faces=0
> kernels=0
> primitives=2
> map3d=0
> 
> Now, as you suggested, i need to apply the v.clean (with break) to create
> the nodes at the intersection of isolines and boundary of the catchment
> vector.
> 
> And for the input of v.clean, I patched the above two vectors using
> v.patch. Please correct if this is the right step or something else would
> have been done?
> 
>> v.patch input=rain_con_v,basin_v out=rain_comp_v
> WARNING: Vector map  already exists and will be overwritten
> Patching vector map ...
> Patching vector map ...
> Building topology for vector map ...
> Registering primitives...
> 9 primitives registered
> 3643 vertices registered
> Building areas...
>  100%
> 1 areas built
> 1 isles built
> Attaching islands...
>  100%
> Attaching centroids...
>  100%
> Number of nodes: 9
> Number of primitives: 9
> Number of points: 0
> Number of lines: 7
> Number of boundaries: 1
> Number of centroids: 1
> Number of areas: 1
> Number of isles: 1
> Intersections at borders will have to be snapped
> Lines common between files will have to be edited
> The header information also may have to be edited
> v.patch complete. 2 vector maps patched
> 
> rain_comp_v looks like this
> 
>  http://n2.nabble.com/file/n3568825/rain_comp_v.png 
> 
>> v.clean in=rain_comp_v out=rain_comp tool=break --o
> --
> Tool: Threshold
> Break: 0.00e+00
> --
> WARNING: Vector map  already exists and will be overwritten
> Copying vector lines...
> Rebuilding parts of topology...
> Building topology for vector map ...
> Registering primitives...
> 9 primitives registered
> 3643 vertices registered
> Number of nodes: 9
> Number of primitives: 9
> Number of points: 0
> Number of lines: 7
> Number of boundaries: 1
> Number of centroids: 1
> Number of areas: -
> Number of isles: -
> --
> Tool: Break lines at intersections
> --
> Rebuilding topology for output vector map...
> Building topology for vector map ...
> Registering primitives...
> 28 primitives registered
> 3662 vertices registered
> Building areas...
>  100%
> 1 areas built
> 1 isles built
> Attaching islands...
>  100%
> Attaching centroids...
>  100%
> Number of nodes: 28
> Number of primitives: 28
> Number of points: 0
> Number of lines: 26
> Number of boundaries: 1
> Number of centroids: 1
> Number of areas: 1
> Number of isles: 1
> 
>>v.centroids rain_comp out=rain_cen option=add --o
> WARNING: Vector map  already exists and will be overwritten
> Processing features...
> 0 new centroids placed in output map
> Copying attribute table(s)...
> Building topology for vector map ...
> Registering primitives...
> 28 primitives registered
> 3662 vertices registered
> Building areas...
>  100%
> 1 areas built
> 1 isles built
> Attaching islands...
>  100%
> Attaching centroids...
>  100%
> Number of nodes: 28
> Number of