[GRASSLIST:5625] Creating DTM from shapefiles

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources
2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

grass-6.0.0_beta1 compiled with tcltk, png, jpeg, tiff, motif, gdal,
blas, lapack, X, fftw, truetype, opengl
gdal-1.2.5 compiled with geos, jasper, jpeg, png, geotiff
Linux gentoo 2.4.26-gentoo-r9 #2 Tue Sep 28 12:51:29 EEST 2004 i686
AMD Athlon(tm) XP 2500+ AuthenticAMD GNU/Linux

TNX for reading this,
Maris.

From: "Maris Nartiss" <maris.nartiss@gmail.com>

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources

v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds in recent archives of grass5 list. You can also try patching two such vector layers (points and lines) with v.patch in Grass 5.4/5.5. It should preserve labels of both input layers properly. But always check whether the labels were really preserved as they should. It happened to me with one particular dataset that they were not for some reason (though maybe it was the dataset fault). If all is ok then import into 6.0 with v.convert.

2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

v.patch doesn't output any database - so there is nothing to be connected. Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the cats of the input layers preserved, so you result in having lots of features with the same cat, thus it is not virtually possible to prepare an appropriate database manually. All you get in an output of that v.patch is a vectorial drawing actually.

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

v.patch manual should contain some remarks on these issues until it's fixed IMHO.

TNX for reading this,
Maris.

Cheers
Maciek

TNX for quick respnse and explanation. I will work with Grass 5.4.0
instead of 6.0.0 to prepeare DTMs.

Actualy as for newcomer to Grass I found lots of undocumented gochas
in Grass. Dosumentation not always fuly explains output of commands,
influence of aviable flags etc. I spend lot of time just experimenting
with different things to find out what they do. I hope on better
documentation after some time.

BR,
Maris.

On Thu, 3 Feb 2005 19:07:16 +0100, Maciek Sieczka <werchowyna@pf.pl> wrote:

From: "Maris Nartiss" <maris.nartiss@gmail.com>
> Hi,
>
v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds in
recent archives of grass5 list. You can also try patching two such vector
layers (points and lines) with v.patch in Grass 5.4/5.5. It should preserve
labels of both input layers properly. But always check whether the labels
were really preserved as they should. It happened to me with one particular
dataset that they were not for some reason (though maybe it was the dataset
fault). If all is ok then import into 6.0 with v.convert.

v.patch doesn't output any database - so there is nothing to be connected.
Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the cats
of the input layers preserved, so you result in having lots of features with
the same cat, thus it is not virtually possible to prepare an appropriate
database manually. All you get in an output of that v.patch is a vectorial
drawing actually.

v.patch manual should contain some remarks on these issues until it's fixed
IMHO.

> TNX for reading this,
> Maris.

Cheers
Maciek

On Fri, February 4, 2005 10:42, Māris Nartišs said:

TNX for quick respnse and explanation. I will work with Grass 5.4.0
instead of 6.0.0 to prepeare DTMs.

Actualy as for newcomer to Grass I found lots of undocumented gochas
in Grass. Dosumentation not always fuly explains output of commands,
influence of aviable flags etc. I spend lot of time just experimenting
with different things to find out what they do. I hope on better
documentation after some time.

The best would be to give us precise indications on where documentation was
insufficient for you...the ideal would be for you to then write these parts
:wink:

But already letting us know what is missing helps identifying priorities.

Moritz

Maciek and Maris,

V.patch DOES work in GRASS 5.7/6.0. However, it works like it did in GRASS
5.4. That is it simply combines vectors and their cat file. It does not
combine any attribute tables they may have.

I've written a simple script, using ogr2ogr, v.in.ogr, and v.out.ogr that
seems to do this. However, I haven't had much chance to test it yet. If
you'd like to give it a try, I attach it here.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Thu, 3 Feb 2005 19:07:16 +0100
To: Maris Nartiss <maris.nartiss@gmail.com>, <GRASSLIST@baylor.edu>
Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles

From: "Maris Nartiss" <maris.nartiss@gmail.com>

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources

v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds in
recent archives of grass5 list. You can also try patching two such vector
layers (points and lines) with v.patch in Grass 5.4/5.5. It should preserve
labels of both input layers properly. But always check whether the labels
were really preserved as they should. It happened to me with one particular
dataset that they were not for some reason (though maybe it was the dataset
fault). If all is ok then import into 6.0 with v.convert.

2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

v.patch doesn't output any database - so there is nothing to be connected.
Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the cats
of the input layers preserved, so you result in having lots of features with
the same cat, thus it is not virtually possible to prepare an appropriate
database manually. All you get in an output of that v.patch is a vectorial
drawing actually.

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

v.patch manual should contain some remarks on these issues until it's fixed
IMHO.

TNX for reading this,
Maris.

Cheers
Maciek

(attachments)

v.append (1.89 KB)

Guys

Michael is right. I'm sorry for my messing. Indeed only the cats are
preserved in 5.4 v.patch. And indeed v.patch works the same in 5.7/6.0. When
I wrote that labels are preserved by v.patch in 5.4 I was wrong. Patching
cats is all I could do and why I came to conclussion that I managed to patch
labels once - I don't know. Obviously it mixed somehow in my mind and I
wanted to be the wise ass. That was dumb not to doublecheck what I was
writing about before posting to the list. I hope I won't be taken as dumb in
general, though :).

Thanks for the sript Michael. Haven't tried it yet. Does it let me to patch
points and lines?

Maciek

P.S.
Anyway, there could be some note in the v.patch manual regarding it's
current limitations and eventual alternatives. Whom should I bother with this?

----- Original Message ----- From: "Michael Barton" <michael.barton@asu.edu>
To: "Maciek Sieczka" <werchowyna@pf.pl>; "Maris Nartiss"
<maris.nartiss@gmail.com>; <GRASSLIST@baylor.edu>
Sent: Sunday, February 06, 2005 7:09 AM
Subject: [GRASSLIST:5654] Re: Creating DTM from shapefiles

Maciek and Maris,

V.patch DOES work in GRASS 5.7/6.0. However, it works like it did in GRASS
5.4. That is it simply combines vectors and their cat file. It does not
combine any attribute tables they may have.

I've written a simple script, using ogr2ogr, v.in.ogr, and v.out.ogr that
seems to do this. However, I haven't had much chance to test it yet. If
you'd like to give it a try, I attach it here.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Thu, 3 Feb 2005 19:07:16 +0100
To: Maris Nartiss <maris.nartiss@gmail.com>, <GRASSLIST@baylor.edu>
Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles

From: "Maris Nartiss" <maris.nartiss@gmail.com>

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources

v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds
in
recent archives of grass5 list. You can also try patching two such vector
layers (points and lines) with v.patch in Grass 5.4/5.5. It should
preserve
labels of both input layers properly. But always check whether the labels
were really preserved as they should. It happened to me with one
particular
dataset that they were not for some reason (though maybe it was the
dataset
fault). If all is ok then import into 6.0 with v.convert.

2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

v.patch doesn't output any database - so there is nothing to be
connected.
Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the
cats
of the input layers preserved, so you result in having lots of features
with
the same cat, thus it is not virtually possible to prepare an appropriate
database manually. All you get in an output of that v.patch is a
vectorial
drawing actually.

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

v.patch manual should contain some remarks on these issues until it's
fixed
IMHO.

TNX for reading this,
Maris.

Cheers
Maciek

Maciek,

Not to worry. GRASS is a BIG program and hard to know what everything
does--especially across 2 versions. However, I've run into the same problem
recently and so have been testing various options of patching.

I *think* the script lets you patch points, lines, or areas (there is a
selection pull-down to choose). I also *think* it preserves the attribute
files. I don't know how it combines them however, especially if they have
different fields. It uses ogr2ogr, so the documentation to that may help--or
just a bit of trial and error.

I wrote it on a plane to a meeting in Washington, DC and so haven't had time
to test it much. I also need to add a brief routine at the end to clean up
the temporary files it makes and ask someone to test it for temp file
security (assuming I write the routine to delete the temporary files). But
it does show the advantages of using even simple shell scripting in GRASS.
The ease of making a nice GUI interface in scripts is thanks to Radim and
Markus.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Mon, 07 Feb 2005 00:32:33 +0100
To: Michael Barton <michael.barton@asu.edu>, Maris Nartiss
<maris.nartiss@gmail.com>, <grasslist@baylor.edu>
Subject: Re: [GRASSLIST:5654] Re: Creating DTM from shapefiles

Guys

Michael is right. I'm sorry for my messing. Indeed only the cats are
preserved in 5.4 v.patch. And indeed v.patch works the same in 5.7/6.0. When
I wrote that labels are preserved by v.patch in 5.4 I was wrong. Patching
cats is all I could do and why I came to conclussion that I managed to patch
labels once - I don't know. Obviously it mixed somehow in my mind and I
wanted to be the wise ass. That was dumb not to doublecheck what I was
writing about before posting to the list. I hope I won't be taken as dumb in
general, though :).

Thanks for the sript Michael. Haven't tried it yet. Does it let me to patch
points and lines?

Maciek

P.S.
Anyway, there could be some note in the v.patch manual regarding it's
current limitations and eventual alternatives. Whom should I bother with
this?

----- Original Message -----
From: "Michael Barton" <michael.barton@asu.edu>
To: "Maciek Sieczka" <werchowyna@pf.pl>; "Maris Nartiss"
<maris.nartiss@gmail.com>; <GRASSLIST@baylor.edu>
Sent: Sunday, February 06, 2005 7:09 AM
Subject: [GRASSLIST:5654] Re: Creating DTM from shapefiles

Maciek and Maris,

V.patch DOES work in GRASS 5.7/6.0. However, it works like it did in GRASS
5.4. That is it simply combines vectors and their cat file. It does not
combine any attribute tables they may have.

I've written a simple script, using ogr2ogr, v.in.ogr, and v.out.ogr that
seems to do this. However, I haven't had much chance to test it yet. If
you'd like to give it a try, I attach it here.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Thu, 3 Feb 2005 19:07:16 +0100
To: Maris Nartiss <maris.nartiss@gmail.com>, <GRASSLIST@baylor.edu>
Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles

From: "Maris Nartiss" <maris.nartiss@gmail.com>

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources

v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds
in
recent archives of grass5 list. You can also try patching two such vector
layers (points and lines) with v.patch in Grass 5.4/5.5. It should
preserve
labels of both input layers properly. But always check whether the labels
were really preserved as they should. It happened to me with one
particular
dataset that they were not for some reason (though maybe it was the
dataset
fault). If all is ok then import into 6.0 with v.convert.

2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

v.patch doesn't output any database - so there is nothing to be
connected.
Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the
cats
of the input layers preserved, so you result in having lots of features
with
the same cat, thus it is not virtually possible to prepare an appropriate
database manually. All you get in an output of that v.patch is a
vectorial
drawing actually.

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

v.patch manual should contain some remarks on these issues until it's
fixed
IMHO.

TNX for reading this,
Maris.

Cheers
Maciek

Unfortunatly that v.append failed to work. Do realy such easy and
common thing like joining 2 vect data layers is impossible in such
great GIS app?
Maybee I did somtn wrong, so heres error msg. (both vector files are
points - augstump = height points from shapefile and izol_p = isolines
converted to points with v.to.points):

v.append vect1=augstump vect2=izol_p vmerged=test_izolp_augstp
vtype=point vlayer=1
Exporting 74 points/lines...

74 features written
Exporting 172622 points/lines...

172622 features written

GRASS_INFO_WARNING(4919,1): Datum 'unknown' not recognised by GRASS
and no parameters found. Datum transformation will not be possible
using this projection information.
Over-riding projection check.
Proceeding with import...
Layer: test_izolp_augstp
DBMI-DBF driver error:
Column 'CAT' already exists (duplicate name)
Cannot create table.
Error in db_execute_immediate()

Cannot create table: create table test_izolp_augstp (cat integer, CAT
integer, HEIGHT double precision, AUGST double precision)

On Sun, 06 Feb 2005 17:55:30 -0700, Michael Barton
<michael.barton@asu.edu> wrote:

Maciek,

Not to worry. GRASS is a BIG program and hard to know what everything
does--especially across 2 versions. However, I've run into the same problem
recently and so have been testing various options of patching.

I *think* the script lets you patch points, lines, or areas (there is a
selection pull-down to choose). I also *think* it preserves the attribute
files. I don't know how it combines them however, especially if they have
different fields. It uses ogr2ogr, so the documentation to that may help--or
just a bit of trial and error.

I wrote it on a plane to a meeting in Washington, DC and so haven't had time
to test it much. I also need to add a brief routine at the end to clean up
the temporary files it makes and ask someone to test it for temp file
security (assuming I write the routine to delete the temporary files). But
it does show the advantages of using even simple shell scripting in GRASS.
The ease of making a nice GUI interface in scripts is thanks to Radim and
Markus.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

> From: Maciek Sieczka <werchowyna@pf.pl>
> Date: Mon, 07 Feb 2005 00:32:33 +0100
> To: Michael Barton <michael.barton@asu.edu>, Maris Nartiss
> <maris.nartiss@gmail.com>, <grasslist@baylor.edu>
> Subject: Re: [GRASSLIST:5654] Re: Creating DTM from shapefiles
>
> Guys
>
> Michael is right. I'm sorry for my messing. Indeed only the cats are
> preserved in 5.4 v.patch. And indeed v.patch works the same in 5.7/6.0. When
> I wrote that labels are preserved by v.patch in 5.4 I was wrong. Patching
> cats is all I could do and why I came to conclussion that I managed to patch
> labels once - I don't know. Obviously it mixed somehow in my mind and I
> wanted to be the wise ass. That was dumb not to doublecheck what I was
> writing about before posting to the list. I hope I won't be taken as dumb in
> general, though :).
>
> Thanks for the sript Michael. Haven't tried it yet. Does it let me to patch
> points and lines?
>
> Maciek
>
> P.S.
> Anyway, there could be some note in the v.patch manual regarding it's
> current limitations and eventual alternatives. Whom should I bother with
> this?
>
> ----- Original Message -----
> From: "Michael Barton" <michael.barton@asu.edu>
> To: "Maciek Sieczka" <werchowyna@pf.pl>; "Maris Nartiss"
> <maris.nartiss@gmail.com>; <GRASSLIST@baylor.edu>
> Sent: Sunday, February 06, 2005 7:09 AM
> Subject: [GRASSLIST:5654] Re: Creating DTM from shapefiles
>
>
>> Maciek and Maris,
>>
>> V.patch DOES work in GRASS 5.7/6.0. However, it works like it did in GRASS
>> 5.4. That is it simply combines vectors and their cat file. It does not
>> combine any attribute tables they may have.
>>
>> I've written a simple script, using ogr2ogr, v.in.ogr, and v.out.ogr that
>> seems to do this. However, I haven't had much chance to test it yet. If
>> you'd like to give it a try, I attach it here.
>>
>> Michael
>> ____________________
>> C. Michael Barton, Professor of Anthropology
>> School of Human Evolution and Social Change
>> PO Box 872402
>> Arizona State University
>> Tempe, AZ 85287-2402
>> USA
>>
>> Phone: 480-965-6262
>> Fax: 480-965-7671
>> www: <www.public.asu.edu/~cmbarton>
>>
>>
>>> From: Maciek Sieczka <werchowyna@pf.pl>
>>> Date: Thu, 3 Feb 2005 19:07:16 +0100
>>> To: Maris Nartiss <maris.nartiss@gmail.com>, <GRASSLIST@baylor.edu>
>>> Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles
>>>
>>> From: "Maris Nartiss" <maris.nartiss@gmail.com>
>>>> Hi,
>>>>
>>>> I'm beginner with Grass and I have beginners problems :slight_smile:
>>>>
>>>> I have 2 shape files one with lines and second with points. Both of
>>>> them have HEIGHT parameter in attribute tables (lines - int, points -
>>>> float (double precision)). To do some modeling, I need to create
>>>> surface from those files.
>>>> I read some docs and understood, that best surface creation algorithm
>>>> in Grass it RST.
>>>> Now I have Q - how to combine both source vector data layers to feed
>>>> them to v.surf.rst?
>>>> I was trying 2 solutions, but, due to lack of knowledge, both of them
>>>> where dead ends.
>>>> 1) Using v.patch to combine both vector data sources
>>>
>>> v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds
>>> in
>>> recent archives of grass5 list. You can also try patching two such vector
>>> layers (points and lines) with v.patch in Grass 5.4/5.5. It should
>>> preserve
>>> labels of both input layers properly. But always check whether the labels
>>> were really preserved as they should. It happened to me with one
>>> particular
>>> dataset that they were not for some reason (though maybe it was the
>>> dataset
>>> fault). If all is ok then import into 6.0 with v.convert.
>>>
>>>> 2) Convert lines to points and then combine them with v.patch
>>>> both worked fine but when I used d.what.vect I got only "Database
>>>> connection not defined".
>>>
>>> v.patch doesn't output any database - so there is nothing to be
>>> connected.
>>> Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the
>>> cats
>>> of the input layers preserved, so you result in having lots of features
>>> with
>>> the same cat, thus it is not virtually possible to prepare an appropriate
>>> database manually. All you get in an output of that v.patch is a
>>> vectorial
>>> drawing actually.
>>>
>>>> Any ideas, links to howtos etc. welcome.
>>>>
>>>> Maybe as a newbie with some ArcView background I'm unable to
>>>> understand some Grass specific things, who cause my problems, but
>>>> currently Grass docs aren't very helpful, mainly cuz they a bit
>>>> outdated :frowning:
>>>
>>> v.patch manual should contain some remarks on these issues until it's
>>> fixed
>>> IMHO.
>>>
>>>> TNX for reading this,
>>>> Maris.
>>>
>>> Cheers
>>> Maciek
>

Unfortunatly that v.append failed to work. Do realy such easy and
common thing like joining 2 vect data layers is impossible in such
great GIS app?
Maybee I did somtn wrong, so heres error msg. (both vector files are
points - augstump = height points from shapefile and izol_p = isolines
converted to points with v.to.points):

If it is just points, you might try

v.out.ascii map1
v.out.ascii map2
cat map1 map2 > map3'
v.in.ascii in=map3

or something like that

Hamish

M?ris

Thanks for trying v.append. Your test seems to answer one question I have:
What happens if you append 2 files with attribute tables that have different
formats? V.append (ogr2ogr that is) will make a new table with ALL the
fields of both tables and attempt to fill them from each table as
appropriate. However, v.append only really makes sense if you have identical
attribute tables for the two files you are trying to merge. In your case,
you have fields with different names in each of the two files.

With respect to the first error, it looks like you don't have a datum
specified and ogr2ogr wants one. Could you try it with 2 files that DO have
a datum specified (the SAME datum) and have identical attribute table
formats (same field names and field formats)?

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: M?ris Narti¹s <maris.nartiss@gmail.com>
Date: Mon, 7 Feb 2005 16:51:13 +0200
To: <GRASSLIST@baylor.edu>
Subject: [GRASSLIST:5665] Re: Creating DTM from shapefiles

Unfortunatly that v.append failed to work. Do realy such easy and
common thing like joining 2 vect data layers is impossible in such
great GIS app?
Maybee I did somtn wrong, so heres error msg. (both vector files are
points - augstump = height points from shapefile and izol_p = isolines
converted to points with v.to.points):

v.append vect1=augstump vect2=izol_p vmerged=test_izolp_augstp
vtype=point vlayer=1
Exporting 74 points/lines...

74 features written
Exporting 172622 points/lines...

172622 features written

GRASS_INFO_WARNING(4919,1): Datum 'unknown' not recognised by GRASS
and no parameters found. Datum transformation will not be possible
using this projection information.
Over-riding projection check.
Proceeding with import...
Layer: test_izolp_augstp
DBMI-DBF driver error:
Column 'CAT' already exists (duplicate name)
Cannot create table.
Error in db_execute_immediate()

Cannot create table: create table test_izolp_augstp (cat integer, CAT
integer, HEIGHT double precision, AUGST double precision)

On Sun, 06 Feb 2005 17:55:30 -0700, Michael Barton
<michael.barton@asu.edu> wrote:

Maciek,

Not to worry. GRASS is a BIG program and hard to know what everything
does--especially across 2 versions. However, I've run into the same problem
recently and so have been testing various options of patching.

I *think* the script lets you patch points, lines, or areas (there is a
selection pull-down to choose). I also *think* it preserves the attribute
files. I don't know how it combines them however, especially if they have
different fields. It uses ogr2ogr, so the documentation to that may help--or
just a bit of trial and error.

I wrote it on a plane to a meeting in Washington, DC and so haven't had time
to test it much. I also need to add a brief routine at the end to clean up
the temporary files it makes and ask someone to test it for temp file
security (assuming I write the routine to delete the temporary files). But
it does show the advantages of using even simple shell scripting in GRASS.
The ease of making a nice GUI interface in scripts is thanks to Radim and
Markus.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Mon, 07 Feb 2005 00:32:33 +0100
To: Michael Barton <michael.barton@asu.edu>, Maris Nartiss
<maris.nartiss@gmail.com>, <grasslist@baylor.edu>
Subject: Re: [GRASSLIST:5654] Re: Creating DTM from shapefiles

Guys

Michael is right. I'm sorry for my messing. Indeed only the cats are
preserved in 5.4 v.patch. And indeed v.patch works the same in 5.7/6.0. When
I wrote that labels are preserved by v.patch in 5.4 I was wrong. Patching
cats is all I could do and why I came to conclussion that I managed to patch
labels once - I don't know. Obviously it mixed somehow in my mind and I
wanted to be the wise ass. That was dumb not to doublecheck what I was
writing about before posting to the list. I hope I won't be taken as dumb in
general, though :).

Thanks for the sript Michael. Haven't tried it yet. Does it let me to patch
points and lines?

Maciek

P.S.
Anyway, there could be some note in the v.patch manual regarding it's
current limitations and eventual alternatives. Whom should I bother with
this?

----- Original Message -----
From: "Michael Barton" <michael.barton@asu.edu>
To: "Maciek Sieczka" <werchowyna@pf.pl>; "Maris Nartiss"
<maris.nartiss@gmail.com>; <GRASSLIST@baylor.edu>
Sent: Sunday, February 06, 2005 7:09 AM
Subject: [GRASSLIST:5654] Re: Creating DTM from shapefiles

Maciek and Maris,

V.patch DOES work in GRASS 5.7/6.0. However, it works like it did in GRASS
5.4. That is it simply combines vectors and their cat file. It does not
combine any attribute tables they may have.

I've written a simple script, using ogr2ogr, v.in.ogr, and v.out.ogr that
seems to do this. However, I haven't had much chance to test it yet. If
you'd like to give it a try, I attach it here.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Maciek Sieczka <werchowyna@pf.pl>
Date: Thu, 3 Feb 2005 19:07:16 +0100
To: Maris Nartiss <maris.nartiss@gmail.com>, <GRASSLIST@baylor.edu>
Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles

From: "Maris Nartiss" <maris.nartiss@gmail.com>

Hi,

I'm beginner with Grass and I have beginners problems :slight_smile:

I have 2 shape files one with lines and second with points. Both of
them have HEIGHT parameter in attribute tables (lines - int, points -
float (double precision)). To do some modeling, I need to create
surface from those files.
I read some docs and understood, that best surface creation algorithm
in Grass it RST.
Now I have Q - how to combine both source vector data layers to feed
them to v.surf.rst?
I was trying 2 solutions, but, due to lack of knowledge, both of them
where dead ends.
1) Using v.patch to combine both vector data sources

v.patch in 5.7/6.0 is not operational yet. You'll find some workarounds
in
recent archives of grass5 list. You can also try patching two such vector
layers (points and lines) with v.patch in Grass 5.4/5.5. It should
preserve
labels of both input layers properly. But always check whether the labels
were really preserved as they should. It happened to me with one
particular
dataset that they were not for some reason (though maybe it was the
dataset
fault). If all is ok then import into 6.0 with v.convert.

2) Convert lines to points and then combine them with v.patch
both worked fine but when I used d.what.vect I got only "Database
connection not defined".

v.patch doesn't output any database - so there is nothing to be
connected.
Moreover the vector layer resulting from v.patch in 5.7/6.0 has all the
cats
of the input layers preserved, so you result in having lots of features
with
the same cat, thus it is not virtually possible to prepare an appropriate
database manually. All you get in an output of that v.patch is a
vectorial
drawing actually.

Any ideas, links to howtos etc. welcome.

Maybe as a newbie with some ArcView background I'm unable to
understand some Grass specific things, who cause my problems, but
currently Grass docs aren't very helpful, mainly cuz they a bit
outdated :frowning:

v.patch manual should contain some remarks on these issues until it's
fixed
IMHO.

TNX for reading this,
Maris.

Cheers
Maciek

Hi all,
I tried to use the GRASS - R connection but I had some problems.
In particular following the tutorial given by Markus all is well until I make
the kriging.
On my pc the funcion krige.G crashes R, and on an other pc there are no
elements in the ...$zhat and $sehat fields.
Does someone know why?

Thanks in advance,

Silvia

I suggest moving this question for clarification to the STATSGRASS list.

Please state clearly which version of GRASS, which version of R and which
version of the interface package you are using on what platform. Saying R
crashed may mean that it terminated completely, but may also mean that it
responded correctly to your commands. Providing the commands and error
messages verbatim, especially with a simple, reproducible example, does
help a great deal. As it is, no help can be given because too little is
known.

Roger

On Wed, 9 Feb 2005, Silvia Franceschi wrote:

Hi all,
I tried to use the GRASS - R connection but I had some problems.
In particular following the tutorial given by Markus all is well until I make
the kriging.
On my pc the funcion krige.G crashes R, and on an other pc there are no
elements in the ...$zhat and $sehat fields.
Does someone know why?

Thanks in advance,

Silvia

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand@nhh.no

Thanks,
on my pc I have GRASS 5.7 and R-2.0.1, I can not send any error because the
program crashes and do not write any error message.
The other pc has GRASS 6.0 and R-2.0.1, here all seems to be right but if you
want to plot the results there is an error message:

plot(G, surf.krig$zhat, col=grey(9:2/9))

   Error in xy.coords(x, y, xlabel, ylabel, log) :
   x and y lengths differ

surf.krig

.....
.....

$zhat
numeric(0)

$sehat
numeric(0)

I use the data of maas and the commands to make kriging:
- first use the log of the data
- second make the point object
- third make the pair object
- fourth estimate the variogram
- fifth fit the variogram with the gaussian and the exponential models
- make the kriging with the comand:
surf.krig <- krige.G(logmaas.point, "lz", logmaas.varEmod, G)

It could it be a problem of the region settings on the other pc but I don't
know on my pc what it could be...

Thanks Silvia

I suggest moving this question for clarification to the STATSGRASS list.

Please state clearly which version of GRASS, which version of R and which
version of the interface package you are using on what platform. Saying R
crashed may mean that it terminated completely, but may also mean that it
responded correctly to your commands. Providing the commands and error
messages verbatim, especially with a simple, reproducible example, does
help a great deal. As it is, no help can be given because too little is
known.

Roger

On Wed, 9 Feb 2005, Silvia Franceschi wrote:

Thanks,
on my pc I have GRASS 5.7 and R-2.0.1, I can not send any error because the
program crashes and do not write any error message.
The other pc has GRASS 6.0 and R-2.0.1, here all seems to be right but if you
want to plot the results there is an error message:

OK. GRASS 5.7 and 6.0 are the answer. The R-GRASS interface works for
GRASS <= 5.4. After GRASS 5.4, the WINDOW has been changed, meaning that
you have to use gmeta(interp=TRUE) until some way of accommodating the
major change in WINDOW handling in GRASS has been found that doesn't break
the interface for <= 5.4. Please post the command you use to get the GRASS
metadata - is it:

G <- gmeta()

Please also post summary(G).

In general I would suggest that you rather use the R gstat package,
krige.G() is just an illustration, not a proper function:

bmd142 <- vgm(158232, "Exp", 361.6, 24803.4)
g.zinc <- gstat(formula=Zn~1, location=~east+north, data=utm.maas,
  model=bmd142)
res <- predict(g.zinc, newdata=data.frame(east=east(G), north=north(G)),
  mask=maasmask)
plot(G, res$var1.pred)

is an example using the utm.maas data set (not tried here).

Roger

> plot(G, surf.krig$zhat, col=grey(9:2/9))
   Error in xy.coords(x, y, xlabel, ylabel, log) :
   x and y lengths differ
> surf.krig
.....
.....

$zhat
numeric(0)

$sehat
numeric(0)

I use the data of maas and the commands to make kriging:
- first use the log of the data
- second make the point object
- third make the pair object
- fourth estimate the variogram
- fifth fit the variogram with the gaussian and the exponential models
- make the kriging with the comand:
surf.krig <- krige.G(logmaas.point, "lz", logmaas.varEmod, G)

It could it be a problem of the region settings on the other pc but I don't
know on my pc what it could be...

Thanks Silvia

> I suggest moving this question for clarification to the STATSGRASS list.
>
> Please state clearly which version of GRASS, which version of R and which
> version of the interface package you are using on what platform. Saying R
> crashed may mean that it terminated completely, but may also mean that it
> responded correctly to your commands. Providing the commands and error
> messages verbatim, especially with a simple, reproducible example, does
> help a great deal. As it is, no help can be given because too little is
> known.
>
> Roger
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand@nhh.no

Hi,

Seems, that joining two vector data sets (shapefiles) in Grass is
"mission impossible".

What happens if you append 2 files with attribute tables that have different
formats?

Actualy for me, lamer, they look like same:

v.db.connect map=augstump driver=dbf
database=/home/maris/Test_in_grass/testlocation/testmapset/dbf/
key=cat layer=1 -c
INTEGER|CAT
DOUBLE PRECISION|AUGST

v.db.connect map=izol_p driver=dbf
database=/home/maris/Test_in_grass/testlocation/testmapset/dbf/
key=cat layer=1 -c
INTEGER|CAT
DOUBLE PRECISION|AUGST

And v.append error:

v.append vect1=augstump vect2=izol_p vmerged=augstump_izol_p
vtype=point vlayer=1
Exporting 74 points/lines...
74 features written
Exporting 172640 points/lines...
172640 features written
Datum 'unknown' not recognised by GRASS and no parameters found. Datum
transformation will not be possible using this projection information.
Over-riding projection check.
Proceeding with import...
Layer: augstump_izol_p
DBMI-DBF driver error:
Column 'CAT' already exists (duplicate name)
Cannot create table.
Error in db_execute_immediate()
Cannot create table: create table augstump_izol_p (cat integer, CAT
integer, AUGST double precision)

_______________________________________
I know what I want, but duno how to get it.
My idea: 2 vect. data sets with 2 dbs. Take first of them, get max cat
num. Take second one and increase cat by first max cat num. Append
second to first w/o problems (ie. cat 2 >> 1), cuz cat nums not
owerlap. Wola. One data set containing data from both input sets.
Is it possible in Grass? Or I need to start to study ArcInfo?

Oh, yeah. That datum thing. As v.append has problems with db, i dont
think, that setting other datum will help.
Anyway, heres msg. from v.in.ogr:
"GRASS_INFO_WARNING(2915,1): Datum 'GRS_1980' not recognised by GRASS
and no parameters found. Datum transformation will not
be possible using this projection information.
Projection of input dataset and current location appear to match.
Proceeding with import..."

Any ideas, links to docs/tutorials/man pages welcome.

Maris.

On Tue, 08 Feb 2005 00:16:53 -0700, Michael Barton
<michael.barton@asu.edu> wrote:

M?ris

Thanks for trying v.append. Your test seems to answer one question I have:
What happens if you append 2 files with attribute tables that have different
formats? V.append (ogr2ogr that is) will make a new table with ALL the
fields of both tables and attempt to fill them from each table as
appropriate. However, v.append only really makes sense if you have identical
attribute tables for the two files you are trying to merge. In your case,
you have fields with different names in each of the two files.

With respect to the first error, it looks like you don't have a datum
specified and ogr2ogr wants one. Could you try it with 2 files that DO have
a datum specified (the SAME datum) and have identical attribute table
formats (same field names and field formats)?

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Thu, February 10, 2005 13:05, Māris Nartišs said:

Hi,

Seems, that joining two vector data sets (shapefiles) in Grass is
"mission impossible".

What happens if you append 2 files with attribute tables that have different
formats?

Actualy for me, lamer, they look like same:

v.db.connect map=augstump driver=dbf
database=/home/maris/Test_in_grass/testlocation/testmapset/dbf/
key=cat layer=1 -c
INTEGER|CAT
DOUBLE PRECISION|AUGST

v.db.connect map=izol_p driver=dbf
database=/home/maris/Test_in_grass/testlocation/testmapset/dbf/
key=cat layer=1 -c
INTEGER|CAT
DOUBLE PRECISION|AUGST

And v.append error:

v.append vect1=augstump vect2=izol_p vmerged=augstump_izol_p
vtype=point vlayer=1
Exporting 74 points/lines...
74 features written
Exporting 172640 points/lines...
172640 features written
Datum 'unknown' not recognised by GRASS and no parameters found. Datum
transformation will not be possible using this projection information.
Over-riding projection check.
Proceeding with import...
Layer: augstump_izol_p
DBMI-DBF driver error:
Column 'CAT' already exists (duplicate name)

It seems to try to create a table containing all columns from the original two
tables. Try renaming the columns of one of the tables to CAT2 and AUGST2 and
see what happens.

Cannot create table.
Error in db_execute_immediate()
Cannot create table: create table augstump_izol_p (cat integer, CAT
integer, AUGST double precision)

_______________________________________
I know what I want, but duno how to get it.
My idea: 2 vect. data sets with 2 dbs. Take first of them, get max cat
num. Take second one and increase cat by first max cat num. Append
second to first w/o problems (ie. cat 2 >> 1), cuz cat nums not
owerlap. Wola. One data set containing data from both input sets.
Is it possible in Grass? Or I need to start to study ArcInfo?

If the above suggestion works, you could then use simple SQL to populate one
CAT column with unique cat nums.

Moritz

Replying to myself to correct what I wrote:

On Thu, February 10, 2005 13:18, Moritz Lennert said:

On Thu, February 10, 2005 13:05, Māris Nartišs said:

And v.append error:

v.append vect1=augstump vect2=izol_p vmerged=augstump_izol_p
vtype=point vlayer=1
Exporting 74 points/lines...
74 features written
Exporting 172640 points/lines...
172640 features written
Datum 'unknown' not recognised by GRASS and no parameters found. Datum
transformation will not be possible using this projection information.
Over-riding projection check.
Proceeding with import...
Layer: augstump_izol_p
DBMI-DBF driver error:
Column 'CAT' already exists (duplicate name)

It seems to try to create a table containing all columns from the original two
tables. Try renaming the columns of one of the tables to CAT2 and AUGST2 and
see what happens.

Actually, I think v.in.ogr automatically creates a CAT column, unless you use
the the "cnames" option (which I haven't really understood, yet, though). So,
if your data contains a CAT columns this would be the second column with this
name and so is rejected.

Rename the CAT colums to something else in the original data, or do the steps
in v.append one by one and use the cname option.

Moritz

Hi,

thanks. I renamed vect1 cat column to cat1. Then reconnectd db usin
cat1 as category. Then I used v.append and got good results: one
vector data set with single db. This db now contains columns cat, cat1
and augst. cat = cat1 for points from vect1 data; cat1 = 0 and with
new cat vaules for data from vect2. Most important - data in augst is
for all records. Now I can delete unnecesary cat1 and will got 2
merged vector data sets :slight_smile:

Actualy I cant fuly understand how I got results, but I have them :slight_smile:
Some more easy way for all grass users would be nice (developers - you
read this?).

TNX all,
Maris

On Thu, 10 Feb 2005 13:18:03 +0100 (CET), Moritz Lennert
<mlennert@club.worldonline.be> wrote:

It seems to try to create a table containing all columns from the original two
tables. Try renaming the columns of one of the tables to CAT2 and AUGST2 and
see what happens.

If the above suggestion works, you could then use simple SQL to populate one
CAT column with unique cat nums.

Moritz

We just tested v.append with a set of vector files derived from DGN CAD
maps, imported into a UTM region with a WGS84 datum. It worked just fine,
combining both the vectors and attribute tables as I hoped. It (ogr2ogr that
is) automatically renamed the cat field to cat_ because, as Moritz notes, it
automatically creates a sequential cat value for the new vector file.

I am attaching a new version that is somewhat improved and more secure
(using g.tempfile) following advice from Hamish. I'll put this up on my
website. If people like it and it continues to work well, I can do a doc
page and add it to the CVS scripts too.

Michael

______________________________
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

From: M?ris Nartišs <maris.nartiss@gmail.com>
Date: Thu, 10 Feb 2005 15:58:18 +0200
To: <mlennert@club.worldonline.be>
Cc: <grasslist@baylor.edu>
Subject: [GRASSLIST:5713] Re: Creating DTM from shapefiles

Hi,

thanks. I renamed vect1 cat column to cat1. Then reconnectd db usin
cat1 as category. Then I used v.append and got good results: one
vector data set with single db. This db now contains columns cat, cat1
and augst. cat = cat1 for points from vect1 data; cat1 = 0 and with
new cat vaules for data from vect2. Most important - data in augst is
for all records. Now I can delete unnecesary cat1 and will got 2
merged vector data sets :slight_smile:

Actualy I cant fuly understand how I got results, but I have them :slight_smile:
Some more easy way for all grass users would be nice (developers - you
read this?).

TNX all,
Maris

On Thu, 10 Feb 2005 13:18:03 +0100 (CET), Moritz Lennert
<mlennert@club.worldonline.be> wrote:

It seems to try to create a table containing all columns from the original
two
tables. Try renaming the columns of one of the tables to CAT2 and AUGST2 and
see what happens.

If the above suggestion works, you could then use simple SQL to populate one
CAT column with unique cat nums.

Moritz

(attachments)

v.append (2.08 KB)

I've been using this method for a while, didn't come up with a script tho. But while it works, I find it extremely (painfully) slow - exporting 10s of 1000s of point takes many HOURS for me. ogr2ogr appends very fast, since that's exactly what it is doing - appending. The import goes much faster than the export.

I hope someone is working on v.patch so this can be done natively in GRASS. Until that happens, I'll probably use the script, thanks.

On Feb 11, 2005, at 11:58 AM, Michael Barton wrote:

We just tested v.append with a set of vector files derived from DGN CAD
maps, imported into a UTM region with a WGS84 datum. It worked just fine,
combining both the vectors and attribute tables as I hoped. It (ogr2ogr that
is) automatically renamed the cat field to cat_ because, as Moritz notes, it
automatically creates a sequential cat value for the new vector file.

I am attaching a new version that is somewhat improved and more secure
(using g.tempfile) following advice from Hamish. I'll put this up on my
website. If people like it and it continues to work well, I can do a doc
page and add it to the CVS scripts too.

Michael

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

First Pogril: Why is life like sticking your head in a bucket filled with hyena offal?
Second Pogril: I don't know. Why IS life like sticking your head in a bucket filled with hyena offal?
First Pogril: I don't know either. Wretched, isn't it?

-HitchHiker's Guide to the Galaxy