Hello Nathan, <br><br>thanks for your <a href="http://woostuff.wordpress.com/2011/06/07/opening-ms-sql-server-2008-spatial-tables-in-qgis-correctly/">last blog post </a>on MSSQL.<br>Just a little question : ogr2ogr create a geometry type with -overwrite control<br>
It is possible to use the geography GEOM_TYPE ? (<span lang="en"><span title="Cliquer ici pour voir d'autres traductions">all</span> <span title="Cliquer ici pour voir d'autres traductions">my</span> <span title="Cliquer ici pour voir d'autres traductions">tables</span> <span title="Cliquer ici pour voir d'autres traductions">are</span> <span title="Cliquer ici pour voir d'autres traductions">in</span> <span title="Cliquer ici pour voir d'autres traductions">geography type)</span></span><br>

<br>On OSGeo4w shell :<br>ogr2ogr -overwrite -f MSSQLSpatial "MSSQL:server=server;database=<div id=":12o">basename;trusted_connection=yes;GeometryFormat=wkb" "C:\Shape\temp.shp" -lco SRID=4326 -lco GEOM_TYPE=GEOGRAPHY<br>
<br>return : <br>
ERROR 1: INSERT command for new feature failed. [Microsoft][ODBC SQL Server Driv<br>er][SQL Server]A .NET Framework error occurred during execution of user-defined<br>routine or aggregate "geography":<br>System.FormatException: 24204: The spatial reference identifier (SRID) is not va<br>

lid. The specified SRID must match one of the supported SRIDs displayed in the s<br>ys.spatial_reference_systems catalog view.<br><br>yet, there is [4326    EPSG    4326    GEOGCS["WGS 84",...] on the sys.spatial_reference_systems<br>

<br><span lang="en"><span title="Cliquer ici pour voir d'autres traductions">Have you</span> <span title="Cliquer ici pour voir d'autres traductions">encountered</span> <span title="Cliquer ici pour voir d'autres traductions">the same</span> <span title="Cliquer ici pour voir d'autres traductions">problem ?</span></span></div>
<br><br><div class="gmail_quote">2011/4/13 Nathan Woodrow <span dir="ltr"><<a href="mailto:madmanwoo@gmail.com">madmanwoo@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The issue is not with the python code itself but rather something in the qgis code for the ogr provider.  I know there is a bug there I'm just having trouble tracking down what it is.<div><div></div><div class="h5"><br>
<br><div class="gmail_quote">On Wed, Apr 13, 2011 at 6:07 PM, Yves Jacolin <span dir="ltr"><<a href="mailto:yjacolin@free.fr" target="_blank">yjacolin@free.fr</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Christophe,<br>
<br>
Why do you say the issue come from the python code? Your example shows nothing<br>
;)<br>
<br>
What is the result of your last command?<br>
<br>
Y.<br>
Le mercredi 13 avril 2011 09:49:04, Christophe B a écrit :<br>
<div><div></div><div>> Hello Yves,<br>
><br>
> I tried to convert my table to a shapfile with ogr2ogr (GDAL 1.8.0,<br>
> released 2011/01/02) and it works : my shapfile has geometry and attribute<br>
> data. It is therefore a problem whis python code !<br>
><br>
> >>> conn_string ="MSSQL:server=.\SQLEXPRESS;<br>
><br>
> database=ObservatoireCommerce;tables=dbo.T_CommuneGeographie;trusted_connec<br>
> tion=yes"<br>
><br>
> >>> qgis.utils.iface.addVectorLayer(conn_string,'test','ogr')<br>
><br>
> 2011/4/12 Yves Jacolin <<a href="mailto:yjacolin@free.fr" target="_blank">yjacolin@free.fr</a>><br>
><br>
> > Christophe,<br>
> ><br>
> > could you test ogr directly to connect to your SQL Server? For example<br>
> > convert<br>
> > sql server layer into shapefile. You will know if this is an ogr or QGIS<br>
> > issue.<br>
> ><br>
> > Y.<br>
> ><br>
> > Le mardi 12 avril 2011 12:39:21, Nathan Woodrow a écrit :<br>
> > > This seems to be a bug, I have noticed it is happens mainly on  Windows<br>
> ><br>
> > XP<br>
> ><br>
> > > but Windows 7 also has this bug.  I'm not sure where the problem is, I<br>
> > > suspect QGIS as OGR via command line returns the correct objects.<br>
> > ><br>
> > > - Nathan<br>
> > ><br>
> > > On Tue, Apr 12, 2011 at 8:16 PM, Christophe B <<a href="mailto:ampouillle@gmail.com" target="_blank">ampouillle@gmail.com</a>><br>
> ><br>
> > wrote:<br>
> > > > Hello List,<br>
> > > ><br>
> > > > I now test the ability to connect to SQL Server data whis GDAL 1.8 of<br>
> > > > QGIS 1.7.<br>
> > > > The connection is correct but I have no geometry in return, and the<br>
> ><br>
> > right<br>
> ><br>
> > > > attribute data (error).<br>
> > > > Is a problem in GDAL / OGR? or QGIS 1.7?<br>
> > > ><br>
> > > > Should we open a new ticket ?<br>
> > > ><br>
> > > > Thank you in advance<br>
> > > ><br>
> > > > Christophe Baume<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > Qgis-user mailing list<br>
> > > > <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
> > > > <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> ><br>
> > --<br>
> > Yves Jacolin<br>
> ><br>
> > <a href="http://yjacolin.gloobe.org" target="_blank">http://yjacolin.gloobe.org</a><br>
<br>
</div></div>--<br>
<div>Yves Jacolin<br>
<br>
<a href="http://yjacolin.gloobe.org" target="_blank">http://yjacolin.gloobe.org</a><br>
</div><div><div></div><div>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
<br></blockquote></div><br>