Opened 16 years ago

Last modified 16 years ago

#405 new defect

fatal error while importing specific shapefile

Reported by: cuic Owned by: cuic
Priority: major Milestone:
Component: SHP Provider Version: 3.3.1
Severity: 2 Keywords:
Cc: External ID:

Description

The type of all the shapes in the imported shapefile are PolygonZShape. For some shapes, m_dMMin and m_dMMax are 0. In the SHP specification, there is a note about the M bounding box: if M values are not used then Mmin and Mmax are 0.0. But according to the following codes in

ShapeFileBase::GetFileHeaderDetails (), ShapeFileBase .cpp

, m_bMDataPresent which is a flag indicating whether a shape has “M” value is set to true in such situation. Then fatal error may occure when it tries to read the "M" value.

if ((m_dMMin > fNO_DATA) && (m_dMMax > fNO_DATA))
{
    m_bMDataPresent = true;
    if (m_nFileLength * WORD_SIZE_IN_BYTES > SHPHeaderSize) // only check if there are shapes
        CheckBoundingBox(m_dMMin, m_dMMax, eMinMMaxM);
}
else
    m_bMDataPresent = false;

To fix the defect, change the if condition to:

if ((m_dMMin > fNO_DATA) && (m_dMMax > fNO_DATA) && (m_dMMin != 0.0) && (m_dMMax != 0.0))

Change History (1)

comment:1 by cuic, 16 years ago

The last line is " if ((m_dMMin > fNO_DATA) && (m_dMMax > fNO_DATA) && (m_dMMin != 0.0) && (m_dMMax != 0.0)) ".

I don't know why the last line is not displayed.

Note: See TracTickets for help on using tickets.