[GRASSLIST:4818] transition probability

Greetings-

I am curious if anyone has ever used GRASS in conjunction with T-PROGS for
transition probability studies...

If it hasn't, I am wondering if there are a couple of vector commands that
could do the following:

given an input polygon map of several categories, and a line drawn across
these categories,

1. sample the polygon boundaries(and their respective category) that the line
intersects

2. put the above information into a new vector line that contains line
segments that have an attribute that matches the category of the polygon that
they intersected.

If I could get this far, I figure that a bit of programming could get the data
into a format that T-PROGS will accept. I would be willing to incorporate my
findings back in to GRASS as a module or script (?) if anyone is interested.

Any thoughts, or is this just far too crazy? :wink:

PS: GRASS is starting to gain popularity here at the university, perhaps in a
year or so we will have a user group...

--
Dylan Beaudette
Soil Science Graduate Group
University of California at Davis

Dylan Beaudette wrote:

If it hasn't, I am wondering if there are a couple of vector commands that could do the following:

given an input polygon map of several categories, and a line drawn across these categories,

1. sample the polygon boundaries(and their respective category) that the line intersects

2. put the above information into a new vector line that contains line segments that have an attribute that matches the category of the polygon that they intersected.

v.overlay

Radim

On Saturday 13 November 2004 12:45 am, you wrote:

Dylan Beaudette wrote:
> If it hasn't, I am wondering if there are a couple of vector commands
> that could do the following:
>
> given an input polygon map of several categories, and a line drawn across
> these categories,
>
> 1. sample the polygon boundaries(and their respective category) that the
> line intersects
>
> 2. put the above information into a new vector line that contains line
> segments that have an attribute that matches the category of the polygon
> that they intersected.

v.overlay

Radim

Thanks for the idea. One quick question: I noticed in the manual for v.overaly
(5.7-cvs) that:
"v.overlay allows the user to overlay to vector area maps."

Therefore I am wondering if this will work with a line....

Thanks,

--
Dylan Beaudette
Soil Science Graduate Group
University of California at Davis

On Saturday 13 November 2004 12:45 am, you wrote:

Dylan Beaudette wrote:
> If it hasn't, I am wondering if there are a couple of vector commands
> that could do the following:
>
> given an input polygon map of several categories, and a line drawn across
> these categories,
>
> 1. sample the polygon boundaries(and their respective category) that the
> line intersects
>
> 2. put the above information into a new vector line that contains line
> segments that have an attribute that matches the category of the polygon
> that they intersected.

v.overlay

Radim

Seems that I just figured out the answer to my last question in regards to
line vector types.

However, I now have another perhaps more complicated problem..

i have two maps:

t_1 = line map containing a single line

fresno_west = ploygon map with many polygons, and mulitple attributes per
polygon:
-------------------------
db.describe -c fresno_west
Column 1: cat
Column 2: AREA
Column 3: PERIMETER
Column 4: CA653_A_
Column 5: CA653_A_ID
Column 6: MUSYM
Column 7: MUKEY
...
------------------------------
when i use v.overlay with ainput=t_1 atype=line binput=fresno_west btype=area
output=r_1 operator=and ...
I get a map with the following attribute columns:
---------------------------
db.describe -c r_1
Column 1: cat
Column 2: cata
Column 3: catb
---------------------------

this is almost what i want, as each of the line segments in the resulting map
(r_1) is labeled with the category number corresponding to the polygon that
it intersected in the catb attribute column:
(http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…

this is great, but i need to join the attributes from the original polygon
file to the new line file r_1. i imagine that it would be a join on:
r_1.catb ---> fresno_west.cat
...which should then allow corresponding attributes from fresno_west (the
polygon layer) to be connected to r_1 (the output from v.overlay)...

i am able to connect the attribute table from fresno_west to r_1 with the
command;
v.db.connect map=r_1 table=fresno_west key=catb field=2 -o

...but this does not produce the results that i am looking for as the
fresno_west table does not contain a 'catb' column...

.... perhaps I am not fully comprehending the GRASS 57 vector attribute
system.. any ideas?

many thanks!

--
Dylan Beaudette
Soil Science Graduate Group
University of California at Davis

You have to join the tables in Postgres.
I hope to add join table to v.overlay later.

Radim

Dylan Beaudette wrote:

On Saturday 13 November 2004 12:45 am, you wrote:

Dylan Beaudette wrote:

If it hasn't, I am wondering if there are a couple of vector commands
that could do the following:

given an input polygon map of several categories, and a line drawn across
these categories,

1. sample the polygon boundaries(and their respective category) that the
line intersects

2. put the above information into a new vector line that contains line
segments that have an attribute that matches the category of the polygon
that they intersected.

v.overlay

Radim

Seems that I just figured out the answer to my last question in regards to line vector types.

However, I now have another perhaps more complicated problem..

i have two maps:

t_1 = line map containing a single line

fresno_west = ploygon map with many polygons, and mulitple attributes per polygon:
-------------------------
db.describe -c fresno_west
Column 1: cat
Column 2: AREA
Column 3: PERIMETER
Column 4: CA653_A_
Column 5: CA653_A_ID
Column 6: MUSYM
Column 7: MUKEY
...
------------------------------
when i use v.overlay with ainput=t_1 atype=line binput=fresno_west btype=area output=r_1 operator=and ...
I get a map with the following attribute columns:
---------------------------
db.describe -c r_1
Column 1: cat
Column 2: cata
Column 3: catb
---------------------------

this is almost what i want, as each of the line segments in the resulting map (r_1) is labeled with the category number corresponding to the polygon that it intersected in the catb attribute column:
(http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…

this is great, but i need to join the attributes from the original polygon file to the new line file r_1. i imagine that it would be a join on:
r_1.catb ---> fresno_west.cat
...which should then allow corresponding attributes from fresno_west (the polygon layer) to be connected to r_1 (the output from v.overlay)...

i am able to connect the attribute table from fresno_west to r_1 with the command;
v.db.connect map=r_1 table=fresno_west key=catb field=2 -o

...but this does not produce the results that i am looking for as the fresno_west table does not contain a 'catb' column...

.... perhaps I am not fully comprehending the GRASS 57 vector attribute system.. any ideas?

many thanks!

On Monday 15 November 2004 01:01 am, you wrote:

You have to join the tables in Postgres.
I hope to add join table to v.overlay later.

Radim

Thanks for the tip Radim.

I was able to get the tables joined and re-attached to the vector layers by
using MySQL.

if anyone is interested, I have started documenting the process here;
http://169.237.35.250/~dylan/grass_and_tp/

i have noticed that the attribute management section on the GRASS 57 tutorial
that -pertains to MySQL is empty. I would be willing to add to that section
if anyone is interested.

Thank again!

Dylan

Dylan Beaudette wrote:
> On Saturday 13 November 2004 12:45 am, you wrote:
>>Dylan Beaudette wrote:
>>>If it hasn't, I am wondering if there are a couple of vector commands
>>>that could do the following:
>>>
>>>given an input polygon map of several categories, and a line drawn
>>> across these categories,
>>>
>>>1. sample the polygon boundaries(and their respective category) that the
>>>line intersects
>>>
>>>2. put the above information into a new vector line that contains line
>>>segments that have an attribute that matches the category of the polygon
>>>that they intersected.
>>
>>v.overlay
>>
>>Radim
>
> Seems that I just figured out the answer to my last question in regards
> to line vector types.
>
> However, I now have another perhaps more complicated problem..
>
> i have two maps:
>
> t_1 = line map containing a single line
>
> fresno_west = ploygon map with many polygons, and mulitple attributes per
> polygon:
> -------------------------
> db.describe -c fresno_west
> Column 1: cat
> Column 2: AREA
> Column 3: PERIMETER
> Column 4: CA653_A_
> Column 5: CA653_A_ID
> Column 6: MUSYM
> Column 7: MUKEY
> ...
> ------------------------------
> when i use v.overlay with ainput=t_1 atype=line binput=fresno_west
> btype=area output=r_1 operator=and ...
> I get a map with the following attribute columns:
> ---------------------------
> db.describe -c r_1
> Column 1: cat
> Column 2: cata
> Column 3: catb
> ---------------------------
>
> this is almost what i want, as each of the line segments in the resulting
> map (r_1) is labeled with the category number corresponding to the
> polygon that it intersected in the catb attribute column:
> (http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…
>
> this is great, but i need to join the attributes from the original
> polygon file to the new line file r_1. i imagine that it would be a join
> on: r_1.catb ---> fresno_west.cat
> ...which should then allow corresponding attributes from fresno_west (the
> polygon layer) to be connected to r_1 (the output from v.overlay)...
>
> i am able to connect the attribute table from fresno_west to r_1 with the
> command;
> v.db.connect map=r_1 table=fresno_west key=catb field=2 -o
>
> ...but this does not produce the results that i am looking for as the
> fresno_west table does not contain a 'catb' column...
>
> .... perhaps I am not fully comprehending the GRASS 57 vector attribute
> system.. any ideas?
>
> many thanks!

On Mon, Nov 15, 2004 at 10:26:23AM -0800, Dylan Beaudette wrote:

On Monday 15 November 2004 01:01 am, you wrote:
> You have to join the tables in Postgres.
> I hope to add join table to v.overlay later.
>
> Radim

Thanks for the tip Radim.

I was able to get the tables joined and re-attached to the vector layers by
using MySQL.

if anyone is interested, I have started documenting the process here;
http://169.237.35.250/~dylan/grass_and_tp/

i have noticed that the attribute management section on the GRASS 57 tutorial
that -pertains to MySQL is empty. I would be willing to add to that section
if anyone is interested.

Yes, interested.
In any case I want to work a bit on the tutorial the next day.
Contributions, comments are welcome.

Markus

Thank again!

Dylan

> Dylan Beaudette wrote:
> > On Saturday 13 November 2004 12:45 am, you wrote:
> >>Dylan Beaudette wrote:
> >>>If it hasn't, I am wondering if there are a couple of vector commands
> >>>that could do the following:
> >>>
> >>>given an input polygon map of several categories, and a line drawn
> >>> across these categories,
> >>>
> >>>1. sample the polygon boundaries(and their respective category) that the
> >>>line intersects
> >>>
> >>>2. put the above information into a new vector line that contains line
> >>>segments that have an attribute that matches the category of the polygon
> >>>that they intersected.
> >>
> >>v.overlay
> >>
> >>Radim
> >
> > Seems that I just figured out the answer to my last question in regards
> > to line vector types.
> >
> > However, I now have another perhaps more complicated problem..
> >
> > i have two maps:
> >
> > t_1 = line map containing a single line
> >
> > fresno_west = ploygon map with many polygons, and mulitple attributes per
> > polygon:
> > -------------------------
> > db.describe -c fresno_west
> > Column 1: cat
> > Column 2: AREA
> > Column 3: PERIMETER
> > Column 4: CA653_A_
> > Column 5: CA653_A_ID
> > Column 6: MUSYM
> > Column 7: MUKEY
> > ...
> > ------------------------------
> > when i use v.overlay with ainput=t_1 atype=line binput=fresno_west
> > btype=area output=r_1 operator=and ...
> > I get a map with the following attribute columns:
> > ---------------------------
> > db.describe -c r_1
> > Column 1: cat
> > Column 2: cata
> > Column 3: catb
> > ---------------------------
> >
> > this is almost what i want, as each of the line segments in the resulting
> > map (r_1) is labeled with the category number corresponding to the
> > polygon that it intersected in the catb attribute column:
> > (http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…
> >
> > this is great, but i need to join the attributes from the original
> > polygon file to the new line file r_1. i imagine that it would be a join
> > on: r_1.catb ---> fresno_west.cat
> > ...which should then allow corresponding attributes from fresno_west (the
> > polygon layer) to be connected to r_1 (the output from v.overlay)...
> >
> > i am able to connect the attribute table from fresno_west to r_1 with the
> > command;
> > v.db.connect map=r_1 table=fresno_west key=catb field=2 -o
> >
> > ...but this does not produce the results that i am looking for as the
> > fresno_west table does not contain a 'catb' column...
> >
> > .... perhaps I am not fully comprehending the GRASS 57 vector attribute
> > system.. any ideas?
> >
> > many thanks!

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

Dylan,

Thanks for summarizing this. I've tried to follow this and more or less see
what you did, although I'd actually need to go through it to really
understand it.

I've got a similar, but slightly different problem. I will be trying to
figure out how to do it, but hope you or someone else out there can suggest
a solution. It is a general problem that many people might run into.

I have a lot of CAD maps that are digitizations in MicroCAD (*.dgn) of
topographic maps from an area in Spain. When I import them in v.in.ogr, I
get the vector shapes I need. However, the attributes that need to be
attached to the vectors are actually attached to points that mark where the
CAD folks put the label for the vector shape. So, for example, for each
topographic line, I have a nice line without an attribute and a point
somewhere near the line with the elevation value. The same goes for roads,
streams, etc. I can extract each kind of vector shape and each kind of point
to separate maps.

I've done this for areas, but these are lines. I suspect that I can
associate points with their vector shapes geographically by giving each
point a tiny buffer so that it overlays the associated line. But where do I
go from here? If I could get the relevant line cat value into the proper
point attribute table, I could reconnect the lines to the attributes, but
I'm not quite sure how to do this.

I am hoping for a systematic solution that I can put into a shell script to
process these many maps.

Thanks for any advice.

Michael Barton

On 11/15/04 11:26 AM, "Dylan Beaudette" <dylan@iici.no-ip.org> wrote:

On Monday 15 November 2004 01:01 am, you wrote:

You have to join the tables in Postgres.
I hope to add join table to v.overlay later.

Radim

Thanks for the tip Radim.

I was able to get the tables joined and re-attached to the vector layers by
using MySQL.

if anyone is interested, I have started documenting the process here;
http://169.237.35.250/~dylan/grass_and_tp/

i have noticed that the attribute management section on the GRASS 57 tutorial
that -pertains to MySQL is empty. I would be willing to add to that section
if anyone is interested.

Thank again!

Dylan

Dylan Beaudette wrote:

On Saturday 13 November 2004 12:45 am, you wrote:

Dylan Beaudette wrote:

If it hasn't, I am wondering if there are a couple of vector commands
that could do the following:

given an input polygon map of several categories, and a line drawn
across these categories,

1. sample the polygon boundaries(and their respective category) that the
line intersects

2. put the above information into a new vector line that contains line
segments that have an attribute that matches the category of the polygon
that they intersected.

v.overlay

Radim

Seems that I just figured out the answer to my last question in regards
to line vector types.

However, I now have another perhaps more complicated problem..

i have two maps:

t_1 = line map containing a single line

fresno_west = ploygon map with many polygons, and mulitple attributes per
polygon:
-------------------------
db.describe -c fresno_west
Column 1: cat
Column 2: AREA
Column 3: PERIMETER
Column 4: CA653_A_
Column 5: CA653_A_ID
Column 6: MUSYM
Column 7: MUKEY
...
------------------------------
when i use v.overlay with ainput=t_1 atype=line binput=fresno_west
btype=area output=r_1 operator=and ...
I get a map with the following attribute columns:
---------------------------
db.describe -c r_1
Column 1: cat
Column 2: cata
Column 3: catb
---------------------------

this is almost what i want, as each of the line segments in the resulting
map (r_1) is labeled with the category number corresponding to the
polygon that it intersected in the catb attribute column:
(http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…

this is great, but i need to join the attributes from the original
polygon file to the new line file r_1. i imagine that it would be a join
on: r_1.catb ---> fresno_west.cat
...which should then allow corresponding attributes from fresno_west (the
polygon layer) to be connected to r_1 (the output from v.overlay)...

i am able to connect the attribute table from fresno_west to r_1 with the
command;
v.db.connect map=r_1 table=fresno_west key=catb field=2 -o

...but this does not produce the results that i am looking for as the
fresno_west table does not contain a 'catb' column...

.... perhaps I am not fully comprehending the GRASS 57 vector attribute
system.. any ideas?

many thanks!

______________________________
Michael Barton, Professor of Anthropology
School of Human, Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

Dylan,

Thanks for summarizing this. I've tried to follow this and more or less see
what you did, although I'd actually need to go through it to really
understand it.

I've got a similar, but slightly different problem. I will be trying to
figure out how to do it, but hope you or someone else out there can suggest
a solution. It is a general problem that many people might run into.

I have a lot of CAD maps that are digitizations in MicroCAD (*.dgn) of
topographic maps from an area in Spain. When I import them in v.in.ogr, I
get the vector shapes I need. However, the attributes that need to be
attached to the vectors are actually attached to points that mark where the
CAD folks put the label for the vector shape. So, for example, for each
topographic line, I have a nice line without an attribute and a point
somewhere near the line with the elevation value. The same goes for roads,
streams, etc. I can extract each kind of vector shape and each kind of point
to separate maps.

I've done this for areas, but these are lines. I suspect that I can
associate points with their vector shapes geographically by giving each
point a tiny buffer so that it overlays the associated line. But where do I
go from here? If I could get the relevant line cat value into the proper
point attribute table, I could reconnect the lines to the attributes, but
I'm not quite sure how to do this.

v.distance

Radim

Radim,

I check the help and it looks like v.distance will to the trick. I'll try it
out. Thanks.

Michael

On 11/16/04 9:13 AM, "Radim Blazek" <blazek@itc.it> wrote:

Michael Barton wrote:

Dylan,

Thanks for summarizing this. I've tried to follow this and more or less see
what you did, although I'd actually need to go through it to really
understand it.

I've got a similar, but slightly different problem. I will be trying to
figure out how to do it, but hope you or someone else out there can suggest
a solution. It is a general problem that many people might run into.

I have a lot of CAD maps that are digitizations in MicroCAD (*.dgn) of
topographic maps from an area in Spain. When I import them in v.in.ogr, I
get the vector shapes I need. However, the attributes that need to be
attached to the vectors are actually attached to points that mark where the
CAD folks put the label for the vector shape. So, for example, for each
topographic line, I have a nice line without an attribute and a point
somewhere near the line with the elevation value. The same goes for roads,
streams, etc. I can extract each kind of vector shape and each kind of point
to separate maps.

I've done this for areas, but these are lines. I suspect that I can
associate points with their vector shapes geographically by giving each
point a tiny buffer so that it overlays the associated line. But where do I
go from here? If I could get the relevant line cat value into the proper
point attribute table, I could reconnect the lines to the attributes, but
I'm not quite sure how to do this.

v.distance

Radim

______________________________
Michael Barton, Professor of Anthropology
School of Human, Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Tuesday 16 November 2004 07:51 am, you wrote:

Dylan,

Thanks for summarizing this. I've tried to follow this and more or less see
what you did, although I'd actually need to go through it to really
understand it.

[snip]

Sure thing. I have just updated the site and made it a little more user
friendly.

http://169.237.35.250/~dylan/grass_and_tp/

As the week goes on I will continue to update the page, and should have a
complete method by the end of this term (this is for a geostats class
project...)

Dylan

On 11/15/04 11:26 AM, "Dylan Beaudette" <dylan@iici.no-ip.org> wrote:
> On Monday 15 November 2004 01:01 am, you wrote:
>> You have to join the tables in Postgres.
>> I hope to add join table to v.overlay later.
>>
>> Radim
>
> Thanks for the tip Radim.
>
> I was able to get the tables joined and re-attached to the vector layers
> by using MySQL.
>
> if anyone is interested, I have started documenting the process here;
> http://169.237.35.250/~dylan/grass_and_tp/
>
> i have noticed that the attribute management section on the GRASS 57
> tutorial that -pertains to MySQL is empty. I would be willing to add to
> that section if anyone is interested.
>
> Thank again!
>
> Dylan
>
>> Dylan Beaudette wrote:
>>> On Saturday 13 November 2004 12:45 am, you wrote:
>>>> Dylan Beaudette wrote:
>>>>> If it hasn't, I am wondering if there are a couple of vector commands
>>>>> that could do the following:
>>>>>
>>>>> given an input polygon map of several categories, and a line drawn
>>>>> across these categories,
>>>>>
>>>>> 1. sample the polygon boundaries(and their respective category) that
>>>>> the line intersects
>>>>>
>>>>> 2. put the above information into a new vector line that contains
>>>>> line segments that have an attribute that matches the category of the
>>>>> polygon that they intersected.
>>>>
>>>> v.overlay
>>>>
>>>> Radim
>>>
>>> Seems that I just figured out the answer to my last question in regards
>>> to line vector types.
>>>
>>> However, I now have another perhaps more complicated problem..
>>>
>>> i have two maps:
>>>
>>> t_1 = line map containing a single line
>>>
>>> fresno_west = ploygon map with many polygons, and mulitple attributes
>>> per polygon:
>>> -------------------------
>>> db.describe -c fresno_west
>>> Column 1: cat
>>> Column 2: AREA
>>> Column 3: PERIMETER
>>> Column 4: CA653_A_
>>> Column 5: CA653_A_ID
>>> Column 6: MUSYM
>>> Column 7: MUKEY
>>> ...
>>> ------------------------------
>>> when i use v.overlay with ainput=t_1 atype=line binput=fresno_west
>>> btype=area output=r_1 operator=and ...
>>> I get a map with the following attribute columns:
>>> ---------------------------
>>> db.describe -c r_1
>>> Column 1: cat
>>> Column 2: cata
>>> Column 3: catb
>>> ---------------------------
>>>
>>> this is almost what i want, as each of the line segments in the
>>> resulting map (r_1) is labeled with the category number corresponding
>>> to the polygon that it intersected in the catb attribute column:
>>> (http://basho.dept-lawr.ucdavis.edu/~dylan/temp/tp1.png)…
>>>
>>> this is great, but i need to join the attributes from the original
>>> polygon file to the new line file r_1. i imagine that it would be a
>>> join on: r_1.catb ---> fresno_west.cat
>>> ...which should then allow corresponding attributes from fresno_west
>>> (the polygon layer) to be connected to r_1 (the output from
>>> v.overlay)...
>>>
>>> i am able to connect the attribute table from fresno_west to r_1 with
>>> the command;
>>> v.db.connect map=r_1 table=fresno_west key=catb field=2 -o
>>>
>>> ...but this does not produce the results that i am looking for as the
>>> fresno_west table does not contain a 'catb' column...
>>>
>>> .... perhaps I am not fully comprehending the GRASS 57 vector attribute
>>> system.. any ideas?
>>>
>>> many thanks!

______________________________
Michael Barton, Professor of Anthropology
School of Human, Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

--
Dylan Beaudette
Soil Science Graduate Group
University of California at Davis