Opened 11 years ago

Closed 10 years ago

#4626 closed defect (fixed)

MSSQL Spatial and 3D issue

Reported by: ngarel Owned by: tamas
Priority: high Milestone:
Component: OGR_SRS Version: 1.9.0
Severity: major Keywords: mssql spatial



After investigation from the message posted, the writing is probably fine. The reading is not. Using MS SQL Server management tool, I can query the proper 3d coordinates using:

SELECT TOP 1000 [ogr_fid] ,[ogr_geometry].AsTextZM() FROM [Spatial].[dbo].[test01]

According to this blog:

AsTextZM displays 4 dimensions... STAsText displays 2. Don't know what STAsBinary does..

In OGRMSSQLSpatialTableLayer::BuildFields

if ( poDS->GetGeometryFormat() == MSSQLGEOMETRY_WKB )


osFieldList += "].STAsBinary() as ["; osFieldList += pszGeomColumn;

} else if ( poDS->GetGeometryFormat() == MSSQLGEOMETRY_WKT ) {

osFieldList += "].STAsText() as ["; osFieldList += pszGeomColumn;


Should AsTextZM() be used somewhere?

Change History (4)

comment:1 by tamas, 10 years ago

Owner: changed from warmerdam to tamas

comment:2 by tamas, 10 years ago

With regards to the native format it has now been fixed within the scope of this bug #4806. Still also require to fix for GeometryFormat=wkt and GeometryFormat=wkb

comment:3 by tamas, 10 years ago

Fixed in r24967 and r24968

comment:4 by tamas, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.