Many thanks. I was hoping to avoid WFS as I am not familiar with it. Is there some sample code available to give me a kickstart?Edit: Doh! Sorry, I already have WFS working from sample code - I am forgetting what have and haven't got to work. I would still like to actually get a FDO connection to SDE working though, if only just to see it work.
I have also been trying to get the FDO option to connect but have not succeeded. I always get a "Connect Failed" error. string connectionString = @"SDE:servername,5151,databasename,user,password,ParkPolygon";
OgrFeatureLayer arcsdeLayer = new OgrFeatureLayer(connectionString,"OBJECTID");
arcsdeLayer.Open(); // always fails - just added to test
arcsdeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Grass1;
arcsdeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Map1.StaticOverlay.Layers.Add("parks", arcsdeLayer);
ArcSDE Geodatabases
Trevor,
There are several reasons which will cause this issue. Such as the connection string error or the FDO doesn’t support this data type or the data file has some problem. If possible, please send us your data file so that we can find the exact reason.
Thanks,
Howard
Thanks Howard, but I am trying to connect to ArcSDE, so its a little difficult to send you any relevant data. I suspect the problem is my understanding of OGR and FDO - I will keep reading…
Trevor,
Okay, please feel free to let me know if you have any question.
Thanks,
Howard
Howard, Are there any examples of using the FdoFeatureLayer class with ArcSDE available?
Trevor,
We don’t have any because we have not been able to get it to work. :-( It will quickly fail with un-managed memory exceptions form deep in the provider and also has some memory leaks in the FDO core itself. This is what we are working on now and hopefully will see some progress on soon.
David
Thanks for your reply, I misunderstood yesterday’s reply to mean that you actually had it working, but not reliably. Its all clear now. Good luck!
Trevor,
My response was a little vague, here is a more concrete answer. If you pass all the right parameters while the moon is full at high tide it will kind of, sort of, maybe work for about 3 minutes then it craps out.
:-) ... :-(
David
Guys,
Now our ArcSDEExtension is almost ready. Before release it we would like to send some of you for a further test. So if you are interested please e-mail support and we will send the Extension to you.
Thanks,
Ben
Ben,
What is the best way to discuss issues with the ArcSDE extension? I have not been able to get this working. I can open a connection, and I have retrieved the schema and feature names just to make sure I am trying to access a valid layer, but I get an error when drawing:
"System.Reflection.TargetInvocationException was unhandled". Should I post details here, or elsewhere?
Thanks, Trev
Here is my code. Any reason why this should fail? I have checked that I have valid schema and feature names. The ArcSDE layer always fails to draw.
Map1.Width = 600;
Map1.Height = 400;
Map1.CurrentExtent = new RectangleShape(1672000.0, 5714600.0, 1759500.0, 5651000.0);
Map1.MapUnit = GeographyUnit.Meter;
// static layers
ArcSdeFeatureLayer roadLayer = new ArcSdeFeatureLayer("NT075", "5151", "username", "password",
"NPDC_Vector", "objectid", "NPDC_VECTOR_SDEADMIN", "ROAD", "shape");
roadLayer.Open();
roadLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.MajorRoad3;
roadLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
MsSql2008FeatureLayer nztlaLayer = new MsSql2008FeatureLayer(connectString, "NZTLA", "oid");
nztlaLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County1;
nztlaLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
nztlaLayer.Srid = 2193;
Map1.StaticOverlay.Layers.Add("nztla", nztlaLayer);
Map1.StaticOverlay.Layers.Add("road", roadLayer);
Trevor,
After you call the roadLayer.Open can you try to call like roadLayer.FeatureSource.GetAllFeatures(), GetCount or something just to see if that returns anything?
David
David,
I tried various calls, but they all fail too... I have also tried different layers. The following is the exception report for the call: "Collection<feature> f = roadLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);
System.Reflection.TargetInvocationException was unhandled by user code
Message="Exception has been thrown by the target of an invocation."
Source="mscorlib"
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at ThinkGeo.MapSuite.Core.ArcSdeFeatureSource.xa84e7a2896d80066(String x0be0480f4c590361, IEnumerable`1 xb3da24dbcff0ab0a)
at ThinkGeo.MapSuite.Core.ArcSdeFeatureSource.GetAllFeaturesCore(IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetAllFeatures(ReturningColumnsType returningColumnNamesType)
at _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\thinkgeo\Default.aspx.cs:line 29
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: OSGeo.FDO.Common.Exception
Message="The given property name was invalid. "
Source="OSGeo.FDO"
StackTrace:
at OSGeo.FDO.Commands.Feature.ISelectImp.Execute()
at MapSuiteFdoExtension.GeoFdoFeatureSource.GetFeatures(String filterString, IEnumerable`1 returningColumnNames)
InnerException:
I have run out of ideas here. I have tried different layers on both ArcGIS Server 9.3.1 and ArcSDE 9.1. I have updated Map Suite to the most recent version. I still get the same result. Am I the only one experiencing these problems?
Trevor,
Sorry someone has not gotten a hold of you on this. I am going to get with the developers and see if we cannot get you some more help.
David
Trevor,
I met this exception all the time and I can almost be sure that’s because the parameter doesn’t match the right case for the database.
ArcSdeFeatureLayer roadLayer = new ArcSdeFeatureLayer(“NT075”, “5151”, “username”, “password”,
“NPDC_Vector”, “objectid”, “NPDC_VECTOR_SDEADMIN”, “ROAD”, “shape”);
The name of the data base “NPDC_Vector” is not case sensitive but for the other parameters like idColumnName “objectid”, FeatureClassName “ROAD” and geometryColumnName should all be case sensitive. I think Usually the id should be all upper case like “OBJECTID” and the geoColumnName should be “Shape” or “SHAPE”, can you double check if it is right in your case?
I think you already got the new ArcSDE assemblies from our support, right? Here is just how I make that sample working on my side.
1, extract that zip file, copy the MapSuiteArcSdeExtension folder to system32
2, open the test program solution and change the connection parameters to the right one, reference the related assemblies and make it compile
3, run it, and it works fine.
Please let me know if you have any issues about that.
Thanks,
Ben
Ben,
Many thanks! As you suggested, it was the case sensitivity causing the problem, even though there is no case-sensitivity in ArcSDE or the underlying SQL Server. I didn't even think to look at this, and the error gave me no clues.
For example, if I have a field called "OBJECTID", I cannot create another called "objectid" or "Objectid" in ArcSDE as these are deemed to be duplicates.
Trev
Trevor,
Thanks for sharing. Please feel free to let us know if you have more questions.
Thanks,
Howard
Is my understanding correct that we are required to pay extra to connect to ArcSDE?
Nelson,
The Spatial Data Connector is non-free component. This is to reflect the considerable development effort in the code to connect to ArcSde. The free FDO Extension says it supports ArcSde but we found out of the box that was not the case, or maybe it supported certain version on single core machines. We were not able to get that to work without heavy modifications. The modification themselves we offer publicly and will be happy to distribute the modified C++ code changes upon request.
David