For those who are interested in adding ArcSDE data to QGIS. This was done with QGIS 1.7 from the OSGeo4W installer in April 2011. Things may change (almost surely will).
The connection is done through OGR's SDE plugin. And I only tested vector access. Maybe rasters work too... something to try out.
So, since SDE plugin is not distributed or built by default (because a number of ArcSDE files are needed and only those with a license can use them), you will have to build the plugin by yourself. It's not hard since Tamas Szekeres mantains a set of ready to compile projects for several versions of Visual Studio, so you can do this with the free version (Express). Look here.
The steps are roughly the following:
- compile ogr_sde.dll for the version of ogr included in QGIS (you also need ArcSDE sdk files found in its DVD).
- replace gdal18.dll in QGIS folders, with the one you compiled above.
- put ogr_sde.dll into C:\OSGeo4W\bin\gdalplugins\1.8
- copy a bunch of dll's from your compiled version to QGIS folders: xerces-c_28.dll, spatiallite.dll and openjpeg.dll. You also need the ArcSDE libs: sde.dll, sg.dll, and pe.dll. To check if everything is working, try the command line: ogrinfo --formats. If anything's missing it will tell you.
- create a .vrt file with your ArcSDE connection and feature class details.
- add the .vrt to QGIS, and voila.
An example of a .vrt:
<OGRVRTDataSource> <OGRVRTLayer name="layer name in qgis"> <SrcDataSource>SDE:servername,5151,,user,pwd,SCHEMA.TABLENAME,SDE.DEFAULT</SrcDataSource> <SrcLayer>SCHEMA.TABLENAME</SrcLayer> <GeometryType>wkbMultiPolygon</GeometryType> <LayerSRS>+proj=tmerc +lat_0=39.66666666666666 +lon_0=-8.131906111111112 +k=1 +x_0=200180.598 +y_0=299913.01 +ellps=intl +units=m +towgs84=-223.237,110.193,36.649 +no_defs</LayerSRS> </OGRVRTLayer> </OGRVRTDataSource>
<del>The only problem I found was the time it takes to connect (a few minutes). After loading the layer everything worked fine.</del>
Be sure to define the connection to each layer, including the reference to the table name and the version even if it is the default. Look at the example above. This works very fast. I have a project with several layers at it just works.
Alister 2011-06-21: I don't think users should need to compile it themselves - there are ArcSDE drivers available in the OSGeo4W installer... they are just broken. Please see http://forum.qgis.org/viewtopic.php?f=3&t=8835 for some which should work... and for information on the ArcSDE files needed.
Alister 2011-06-28: people might be interested - I think it should be possible to access ArcGIS REST services. Try opening this query url via "layer>add vector layer>Protocol": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json"