[GRASS-user] Integrating multi tables

Dave Kent dkent at sasktel.net
Mon Mar 26 21:19:42 EDT 2007


I have had some success editing dbf files on the Mac using  
OpenOffice.org 2.1. I haven't tried  NeoOffice.  A recent edit  
involved adding a column of calculated values in OpenOffice.  Grass  
recognized the new column.  It doesn't work if you leave the formula  
in place.  I changed them to text using copy and paste special as  
strings.


Dave

On Mar 26, 2007, at 5:24 PM, Richard Chirgwin wrote:

> I knew I was missing something really simple! - I guess more  
> reading on my part into the data model is going to be important. I  
> hadn't realised that it's okay to "split" the storage - to have the  
> locations file in a database that didn't also contain the map  
> outlines.
>
> So now, my backside feels much safer, and next week the boss will  
> have some lovely maps to use at a conference, and I will make damn  
> sure that Grass-GIS gets identified as the source of the maps. So  
> thanks again ...
>
> A couple of things which should be asked/made known.
>
> 1) When importing CSVs (I tried from Excel and from MySQL), the dbf  
> creates all the import tables as Character. I could not find any  
> way to change column type to INT. Is this a limitation on the  
> driver command set?
>
> 2) The Grass Manager db.copy seems to have a bug. With the "select"  
> cursor empty, it tries to set a conditional default (where ...),  
> generating the following error:
> SQL parser error in statement:
> select * from table where 0 = 1
> Error in db_open_select_cursor ()
>
> If I typed the command manually, it worked fine.
>
> 3) Are there programs known to create/edit/save "legal" DBF file  
> formats? On the Mac, at least, creating straight textfiles for  
> import does not work well. Open Office (NeoOffice) opens DBFs quite  
> happily as spreadsheets, but Grass-GIS doesn't like the OO DBF save  
> format (the same applies for Excel).
>
> Cheers and thanks to everyone for the help!
>
> Richard Chirgwin
>
> Moritz Lennert wrote:
>> On 24/03/07 07:34, Richard Chirgwin wrote:
>>> Trying to work this one out, and not getting anywhere!
>>>
>>> I have imported Shapefiles into vector maps.
>>>
>>> I have "population" data (not people but using the same cat  
>>> column IDs as in the shapefile attribute tables).
>>>
>>> How do I integrate the population data so that the shapefiles can  
>>> be coloured in thematic maps?
>>>
>>> I can add columns to the vector attribute tables - but I can't  
>>> find a command that would mass-populate the column
>>> (in MySQL it would be a simple UPDATE Table 1, Table 2 set  
>>> column=column where table 1.cat=table 2.cat).
>>>
>>> (It probably doesn't help that the population data is in MySQL  
>>> but I am happy to import)
>>>
>>> I fear that I am missing something *really* simple but am just  
>>> about going spare trying to find out!
>>
>> If you are using the default GRASS settings, your shapefile data  
>> gets imported as a dbf file. There is no way of combining this  
>> file with others, either in a database application or in GRASS  
>> (i.e. there is no equivalent of ArcView's "joining" tables).
>> However, you are not obliged to work with dbf files, you can  
>> import your shapefile attribute data into mysql and then either  
>> add the colums with your above 'update' command or just create a  
>> view combining the two tables and link your map to this view.
>>
>> Use:
>>
>> - db.connect to define a different database backend (Databases- 
>> >Manage Databases->Connect to database in the GUI)
>> - db.copy to copy an existing table to another table, including  
>> between different backends, i.e. dbf to mysql (Databases->Manage  
>> Databases->Copy table)
>> - v.db.connect to link your map to the table or to the view  
>> (Vector->vector<->database connection->Set database connection...)
>>
>> You can also begin by setting db.connect in a new location, and  
>> then import the shapefile with v.in.ogr. The attribute table is  
>> then automatically created in the database you connected to.
>>
>> Moritz
>>
>
> _______________________________________________
> grassuser mailing list
> grassuser at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassuser




More information about the grass-user mailing list