[GRASSLIST:5227] creating vector points layer from database coordinates

I am trying to create a coverage consisting of x,y points derived from
a mysql data table. Unfortunately, I am running into problems using
both the v.in.db and db.select solutions in the documentation. Using
v.in.db ( v.in.db driver=mysql database=test table=mortality
x=LONGITUDE y=LATITUDE key=recid out=mortality2), I get the following
error:

Error in db_execute_immediate()

WARNING: Cannot create new table: 'create table mortality2 ( recid integer,
         DATE varchar(6), FILEDBY varchar(20), FIELDID varchar(10), FMPCASE
         varchar(5), FMPDIST varchar(2), SEX varchar(1), LENGTH double
precision ... etc.

However, when I cut and paste the sql code into the database directly,
the table is created without any problem!

Next, trying the db.select approach(echo "select
LONGITUDE,LATITUDE,RECID from mortality" | db.select driver=mysql
database=test table=mortality | v.in.ascii output=mortality2), I get a
segmentation fault:

D4/5: row 2944 col 75: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 76: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 77: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 78: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 79: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 80: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 81: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 82: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 83: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 84: 22.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 85: 15.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 86: 7.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 87: 38.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 88: 31.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 89: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 90: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 91: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 92: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 93: 4.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 94: 3.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 95: is_int = 1 is_double = 1
D4/5: row 2944 col 96: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 97: 0.000000 is_int = 0 is_double = 1
D4/5: row 2944 col 98: is_int = 1 is_double = 1
D4/5: row 2944 col 99: is_int = 1 is_double = 1
D4/5: row 2944 col 100: is_int = 1 is_double = 1
D4/5: row 2944 col 101: is_int = 1 is_double = 1
D4/5: row 2944 col 102: -82.432850 is_int = 0 is_double = 1
D4/5: row 2944 col 103: 27.133310 is_int = 0 is_double = 1
Segmentation fault

I am using a recent cvs compile of 5.7 for this. Any hints as to why
either of these methods are failing would be most helpful.

Chris

On Sat, Dec 25, 2004 at 12:25:43PM -0600, we recorded a bogon-computron collision of the <fonnesbeck@gmail.com> flavor, containing:

I am trying to create a coverage consisting of x,y points derived from
a mysql data table. Unfortunately, I am running into problems using
both the v.in.db and db.select solutions in the documentation. Using
v.in.db ( v.in.db driver=mysql database=test table=mortality
x=LONGITUDE y=LATITUDE key=recid out=mortality2), I get the following
error:

Error in db_execute_immediate()

WARNING: Cannot create new table: 'create table mortality2 ( recid integer,
         DATE varchar(6), FILEDBY varchar(20), FIELDID varchar(10), FMPCASE
         varchar(5), FMPDIST varchar(2), SEX varchar(1), LENGTH double
precision ... etc.

You have a varchar(6) field called "DATE" --- grass doesn't like that, as DATE
is a reserved word for SQL.

However, when I cut and paste the sql code into the database directly,
the table is created without any problem!

Perhaps MySQL's parser is able to tell the difference between a field called
DATE and a field with a type of DATE and accepts the create table command.

I had a similar problem that took a while to track down --- the USFS data
layers I had all had fields called DATE (the date the feature was last
field checked, I think) and it took a while to realize why exactly grass
was refusing to import it. In my case, using the "cnames" option to v.in.ogr
got me the workaround I needed.

Can't help you with your segfault, though.

--
Tom Russo KM5VY SAR502 DM64ux http://www.swcp.com/~russo/
Tijeras, NM QRPL#1592 K2#398 SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
"When life gives you lemons, find someone with a paper cut."