[GRASS-user] RE: Problem querying layers other than '1' in gi s.m
Moritz Lennert
mlennert at club.worldonline.be
Mon Sep 25 10:51:57 EDT 2006
Patton, Eric wrote:
> Dylan wrote:
>> Eric, the way that i usually approach this type of problem in GRASS is
>> as follows:
>
>> 1. store my attribute data in a RDBMS such as mysql, postgresql, sqlite,
>> etc.
>> 2. create some vector data with at least two columns: 'cat' and 'id'
>> 'cat' is used by v.db.connect to associate a row with a vector feature
>> 'id' is used to associate other attribute data with a row
>
>> 3. create a new, composite table (from two existing tables 'vector'
>> and 'data') with something like:
>> create table new_table as
>> select vector.cat, vector.id, data.time, data.temp
>>from vector, data
>> where vector.id = data.id ;
>
>> 4. then hookup new_table to the original vector file with v.db.connect
>
>> make sense?
>
> Thanks, Dylan. Your SQL code worked and I now have a single table that
> combines the fields of interest from both tables. However....
>
> Any attempt to edit the field names or types result in the error "Error
> editing field. Message from database engine: near ".": syntax error". I
> should note that as a result of the SQL join of the two tables, the field
> names are really long now:
>
> db.columns table=Rumbolt_Video_Benthos_Corrected_UTC_NR
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.ID
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Station_ID
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Depth_m
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Latitude
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Longitude
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Julian_Day
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.UTM_time
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Sediment_type
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Description
> Rumbolt_Video_Benthos_Uncorrected_UTC_NR.Uncorrected_UTC
> All_UTCs_clock_corrected_NR.ID
> All_UTCs_clock_corrected_NR.Timestamp
>
> Could the error I'm getting be caused by the length of the new field names?
I think the problem is rather the period in the name.
From the Postgresql documentation:
"SQL identifiers and key words must begin with a letter (a-z, but also
letters with diacritical marks and non-Latin letters) or an underscore
(_). Subsequent characters in an identifier or key word can be letters,
underscores, digits (0-9), or dollar signs ($)."
Moritz
>
> ~ Eric.
>
More information about the grass-user
mailing list