Hi All,<div><br></div><div>I wrote a blog post a couple of days ago about opening MS SQL Spatial geometries and it worked fine then but the latest revision can't seem to display them.</div><div><br></div><div>It opens the table correctly, detects the geometry type right and I can even browse the table but no geometries are displayed. </div>
<div><br></div><div>This is the code I use in the Python console to open the layer and then test to see if the geometry is there.</div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
>>> uri = "MSSQL:server=SD0302;database=Test;tables=DRAINAGE;trusted_connection=yes"<br>>>> uri<br>'MSSQL:server=SD0302;database=Test;tables=DRAINAGE;trusted_connection=yes'<br>>>> qgis.utils.iface.addVectorLayer(uri,'drains1','ogr')<br>
<qgis.core.QgsVectorLayer object at 0x1EBD96A8><br>>>> can = qgis.utils.iface.mapCanvas()<br>>>> can<br><qgis.gui.QgsMapCanvas object at 0x0667F7C8><br>>>> can.currentLayer()<br><qgis.core.QgsVectorLayer object at 0x1EBD9F18><br>
>>> can.currentLayer().dataProvider()<br><qgis.core.QgsVectorDataProvider object at 0x1EBD9F60><br>>>> can.currentLayer().select(1)<br>>>> can.currentLayer().select(1)<br>>>> layer.selectedFeatures()<br>
[<qgis.core.QgsFeature object at 0x1EBD9E88>]<br>>>> item = layer.selectedFeatures()[0]<br>>>> item<br><qgis.core.QgsFeature object at 0x1EBD96A8><br>>>> item.isValid()<br>True<br>>>> item.geometry()<br>
<qgis.core.QgsGeometry object at 0x1EBD9F60><br>>>> item.geometry().length()<br>14.968913045995375<br>>>> item.geometry().asWkb()<br>'\x01\x02\x00\x00\x00\x02\x00\x00\x00\xf9 \xdb{\xd2\xb5\x18A\xc5\x19\x0f\x19\x04?ZA\xd4=W\xfb\x96\xb5\x18A\xff\xcf\xea\x83\x04?ZA'<br>
>>> item.geometry().exportToWkt()<br>PyQt4.QtCore.QString(u'LINESTRING(404852.620953 6880272.391547, 404837.745450 6880274.061207)')<br>>>> </blockquote><div> </div><div>When I run can.currentLayer().select(1) QGIS says in the status bar that there is 1 feature selected and I can zoom to the correct spot on the map but nothing is displayed.</div>
<div><br></div><div>Would anyone have any idea what's going on here?</div><div><br></div><div>OS: Windows XP</div><div>QGIS Version r15530</div><div>GDAL/OGR 1.8</div><div><br></div><div>- Nathan</div>