Opened 8 years ago

Closed 8 years ago

#6357 closed defect (fixed)

SXF Fixes

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: SXF
Cc: bishop, alexey

Description

Transcribed from gdal-dev-owner:

some time ago jratike80 recommended send mail to gdal-dev http://trac.osgeo.org/gdal/ticket/5647 i am writing: From: Alexey ILchenko <lexa.ilc@…> To: gdal-dev@… Cc: Date: Mon, 8 Feb 2016 01:14:20 +0300 Subject: SXF Driver Hi all. I think i found some bugs on SXF driver. Check, please.

1)error on index in file ogrsxfdatasource.cpp line 620 and 687 "switch (anData[5])" replace "switch (anData[4])"

2)error in conversion multy part line. in this time they converted on point or one line. examle: "----- ----- -----" -> "." or "----" its not save all geometry

3)if RSC file has no description layer description of objects, all layers after this layer will be removed. why, because y save all object in additional layer:

ogrsxfdatasource.cpp:
1269    papoLayers = (OGRLayer**)CPLRealloc(papoLayers,
sizeof(OGRLayer*)* (nLayers + 1));
1270    papoLayers[nLayers] = new OGRSXFLayer(fpSXF, &hIOMutex, 255,
CPLString("Not_Classified"), oSXFPassport.version,
oSXFPassport.stMapDescription);
1271    nLayers++;
ogrsxflayer.cpp:
"127int OGRSXFLayer::AddRecord(long nFID, unsigned nClassCode,
vsi_l_offset nOffset, bool bHasSemantic, size_t nSemanticsSize)
128{
129    if (mnClassificators.empty() ||
mnClassificators.find(nClassCode) != mnClassificators.end())"

if the empty layer not last will be bad.

4) i think y can add epsg:4326 if (iEllips == 9 && iProjSys == 33) and anData[4]=65 and adfParams[i]=0

Attachments (2)

osm.rsc (423.0 KB ) - added by alexey 8 years ago.
http://gistoolkit.ru/download/classifiers/osm.zip
fordebug.sxf (3.6 KB ) - added by alexey 8 years ago.
10objects

Download all attachments as: .zip

Change History (9)

comment:1 by warmerdam, 8 years ago

Cc: alexey added

comment:2 by Bishop, 8 years ago

Can you provide test sxf + rsc for 2) and 3) to reproduce the bug?

comment:3 by Bishop, 8 years ago

Resolution: fixed
Status: newclosed

Fixed in r33512 The 2 and 3 need some samples to reproduce the bug. If files will be provided, please reopen ticket.

comment:4 by Even Rouault, 8 years ago

It looks to me that the following lines will leak memory since pszRecoded is assigned previously with CPLRecode or CPLStrdup. Also, minor note, CPLStrnlen(pszRecoded, 255) == 0 could be written more simply (and efficiently) as pszRecoded[0] != 0.

    if(CPLStrnlen(pszRecoded, 255) == 0)
        pszRecoded = CPLStrdup("Unnamed");

in reply to:  4 comment:5 by Bishop, 8 years ago

Fix in r33515

by alexey, 8 years ago

Attachment: fordebug.sxf added

10objects

comment:6 by alexey, 8 years ago

Resolution: fixed
Status: closedreopened

2)problem with geometry metric text lable 3)objects going from layer "signature" to layer "direct"

comment:7 by Bishop, 8 years ago

Resolution: fixed
Status: reopenedclosed

Fix in r34024.

Several notes about problem 2:

  1. The problem geometries in test file (fordebug.sxf​) are not multi part line, but multi part text. I added support for such geometries. But this is not error, just new functionality.
  1. The mentioned "incorrect conversion" line to point is correct. According to specification (see. http://gistoolkit.ru/download/doc/sxf4bin.pdf page 17) code xххх0100 is vector POINT object wich has 2 coordinates. First coordinate is anchor, and second - for direction. GDAL create feature with point geometry and add direction to the ANGLE field. This is useful for rotating point symbols according the ANGLE value in most GIS programs.
Note: See TracTickets for help on using tickets.