Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#4951 closed defect (fixed)

lnam_refs is truncated when converting from S57 data with ogr2ogr

Reported by: boatbeacon Owned by: warmerdam
Priority: normal Milestone: 1.9.3
Component: OGR_SF Version: 1.9.2
Severity: normal Keywords: lnam_refs, S57, ogr2ogr, mysql
Cc:

Description

We are using the following command to convert from NOAA S57 ENC data to MySql using gdal-1.9.2 (same error on gdal-1.9.1)

ogr2ogr -gt 1024 -skipfailures -f MySQL MySQL:US5CA13M,host=localhost,user=auser,password=apasswrod US5CA13M.000 -append -lco SPATIAL_INDEX=YES BCNLAT

The conversion completes with the bcnlat table created and populated in MySql but the lnam_refs field (TEXT) is truncated to 16 Chars. I have logged the MySql queries from ogr2ogr and the Insert statement is the culprit - the lnam_refs field has been truncated to 16 characters '(2:02260FB4D3871' . It should have been something like '(2:02260FB5030B12D4,02260FB5030B12C6)' - e.g. a String list with two entries.

here is one of the queries from the log:-

INSERT INTO bcnlat (SHAPE , rcid, prim, grup, objl , rver, agen, fidn, fids, lnam, lnam_refs, ffpt_rind, bcnshp, catlam, colour, objnam, status, inform, scamin, sordat, sorind) VALUES (GeometryFromText('POINT (-122. 3853339 37.7784136)',1) , 14, 1, 2, 7, 1, 550, 263521035, 4835, '02260FB5030B12E3', '(2:02260FB4D3 871', '(2:2,2)', 5, 1, '4', 'South Beach Harbor South Entrance Light 1', '8', 'On breakwater', 119 999, '20010604', 'US,US,graph,Chart 18650')

I have attached the source data file US5CA15M.000 . However this problem is found on all the NOAA S47 ENC translations we are performing.

I notice in that there was a similar bug http://trac.osgeo.org/gdal/ticket/681 from many years ago that was closed. The lnam_refs string in that bug report shows the same lnam_refs field truncation as we are seeing .

Change History (4)

comment:1 by Even Rouault, 11 years ago

The file is not attached...

comment:2 by Even Rouault, 11 years ago

Component: defaultOGR_SF
Resolution: fixed
Status: newclosed

ok, I've reproduced with other S57 files.

You can already workaround the issued by adding "-fieldTypeToString StringList,IntegerList" to the ogr2ogr commandline.

Fixed in trunk (r25513) and branches/1.9 (r25514)

in reply to:  2 comment:3 by boatbeacon, 11 years ago

Replying to rouault:

ok, I've reproduced with other S57 files.

You can already workaround the issued by adding "-fieldTypeToString StringList,IntegerList" to the ogr2ogr commandline.

Fixed in trunk (r25513) and branches/1.9 (r25514)

I can confirm the fix works - fantastic quick turn-around in solving this. Thankyou.

N.B. I tried the suggested workaround too, but the workaround didn't work for me - ogr2ogr wouldn't accept "-fieldTypeToString StringList?,IntegerList?" (note question marks) as input option. "-fieldTypeToString StringList,IntegerList" was accepted but didn't solve the problem with lnam_refs.

comment:4 by boatbeacon, 11 years ago

Aha - the trac tool is inserting the question marks after the StringList and IntegerList words in comments !

Note: See TracTickets for help on using tickets.