[GRASSLIST:5674] Re: Creating DTM from shapefiles

Michael Barton michael.barton at asu.edu
Tue Feb 8 02:16:53 EST 2005


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 at gmail.com>
> Date: Mon, 7 Feb 2005 16:51:13 +0200
> To: <GRASSLIST at 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 at 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 at pf.pl>
>>> Date: Mon, 07 Feb 2005 00:32:33 +0100
>>> To: Michael Barton <michael.barton at asu.edu>, Maris Nartiss
>>> <maris.nartiss at gmail.com>, <grasslist at 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 at asu.edu>
>>> To: "Maciek Sieczka" <werchowyna at pf.pl>; "Maris Nartiss"
>>> <maris.nartiss at gmail.com>; <GRASSLIST at 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 at pf.pl>
>>>>> Date: Thu, 3 Feb 2005 19:07:16 +0100
>>>>> To: Maris Nartiss <maris.nartiss at gmail.com>, <GRASSLIST at baylor.edu>
>>>>> Subject: [GRASSLIST:5626] Re: Creating DTM from shapefiles
>>>>> 
>>>>> From: "Maris Nartiss" <maris.nartiss at gmail.com>
>>>>>> Hi,
>>>>>> 
>>>>>> I'm beginner with Grass and I have beginners problems :)
>>>>>> 
>>>>>> 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 :(
>>>>> 
>>>>> v.patch manual should contain some remarks on these issues until it's
>>>>> fixed
>>>>> IMHO.
>>>>> 
>>>>>> TNX for reading this,
>>>>>> Maris.
>>>>> 
>>>>> Cheers
>>>>> Maciek
>>> 
>> 
>> 




More information about the grass-user mailing list