Skip to content

Commit

Permalink
Merge pull request #5690 from szekerest/mssqlzm
Browse files Browse the repository at this point in the history
Fix MSSQL driver when parsing geometries with ZM values (#5689)
  • Loading branch information
szekerest committed Oct 27, 2018
2 parents 3c44e49 + 540d613 commit c95be7d
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions mapmssql2008.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,21 @@ void ReadPoint(msGeometryParserInfo* gpi, pointObj* p, int iPoint)
}

#ifdef USE_POINT_Z_M
if ( gpi->chProps & SP_HASZVALUES )
if ((gpi->chProps & SP_HASZVALUES) && (gpi->chProps & SP_HASMVALUES))
{
p->z = ReadZ(iPoint);
if ( gpi->chProps & SP_HASMVALUES )
p->z = ReadM(iPoint);
p->m = ReadM(iPoint);
}
else if (gpi->chProps & SP_HASZVALUES)
{
p->z = ReadZ(iPoint);
p->m = 0.0;
}
else if (gpi->chProps & SP_HASMVALUES)
{
p->z = 0.0;
p->m = ReadZ(iPoint);
}
#endif
}

Expand All @@ -271,12 +282,13 @@ int ParseSqlGeometry(msMSSQL2008LayerInfo* layerinfo, shapeObj *shape)

gpi->chProps = ReadByte(5);

gpi->nPointSize = 16;

if ( gpi->chProps & SP_HASMVALUES )
gpi->nPointSize = 32;
else if ( gpi->chProps & SP_HASZVALUES )
gpi->nPointSize = 24;
else
gpi->nPointSize = 16;
gpi->nPointSize += 8;

if ( gpi->chProps & SP_HASZVALUES )
gpi->nPointSize += 8;

if ( gpi->chProps & SP_ISSINGLEPOINT ) {
// single point geometry
Expand Down

0 comments on commit c95be7d

Please sign in to comment.