[GRASSLIST:3917] Re: How to generate merge key in Grass to enable merging data in R?

Radim Blazek blazek at itc.it
Thu Jul 15 04:38:57 EDT 2004


On Wednesday 14 July 2004 19:12, Craig Aumann wrote:
> On Wed, 2004-07-14 at 01:55, Radim Blazek wrote:
> > On Tuesday 13 July 2004 23:27, Craig Aumann wrote:
> > > What I then do is read the text file "seismic.txt" into R and find the
> > > center of the line.  What I want to do now is link these centers to the
> > > attribute data which is sitting in the attribute database.  Reading the
> > > attribute database into R is easy:
> >
> > You can generate centers with v.segment (calculate length/2 first).
> >
> > Radim
>
> I don't think I completely I understand your approach here.   Why do you
> want length/2 and secondly, how would one calculate/get at this?  I
> suspect under your approach I'd also need either the begining or ending
> vertex for the vector...

echo "alter table lines add column len double precision" | db.execute
v.to.db map=lines option=length col1=len
echo "select cat,length/2 from lines" | db.select -c \
  | sed 's/\(.*\)|\(.*\)/P \1 \1 \2/' | v.segment input=lines output=centres

> v.extract input=seismic output=seismiccenter type=centroid field=1
> where="(width >= '0')"
>
> -----------------------
>
> I (incorrectly??) thought that v.extract would extract the centroid of
> the line.  The output of v.extract above is distressing:

Centroid is geometry element type used to identify areas, not center of a line.

Radim




More information about the grass-user mailing list