1

For a project I have to load a WFS layer in ArcMap programmatically. Since Version 10.0 there is no ability to use the FMEWorkspace as discussed here.

The only way to load WFS-Data to ArcMap is to use QuickImport from ESRI.ArcGIS.DataInteroperabilityTools. If someone knows another trick, please tell!

Now I have a problem in consuming the geoprocessing-tool. As input I give the content of a fdl-file (without "FDLVERSION1,") which before was created while connecting to wfs via Add Interoperability Connection manually.

As output I want to give a file-geodatabase which I think is causing the problem. It is created correctly, but maybe for the tool it must not exist anyway?

Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;

ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker();

string input = File.ReadAllText(fdlFile, Encoding.UTF8);
QuickImport import = new QuickImport();
import.Input = input.Replace("FDLVERSION1,", ""); ;
//import.Output = "C:/temp/wfs.gdb";

Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
IWorkspaceName wsn=workspaceFactory.Create("C:/temp", "wfs.gdb", null, 0);
import.Output = wsn;

try
{
    // error occurs here:
    object resi = gp.Execute(import, trac);
}
catch (Exception ex)
{}

Has anyone used this geoprocessing tool or has any idea?

EDIT:

I also tried it with ESRI.ArcGIS.Geoprocessing.IGeoProcessor2 - but same error:

ESRI.ArcGIS.Geoprocessing.IGeoProcessor2 gp = new ESRI.ArcGIS.Geoprocessing.GeoProcessorClass();
gp.OverwriteOutput = true;

ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker();

IVariantArray parameters = new VarArrayClass();

parameters.Add(@"WFS,https://www....");
parameters.Add("C:/temp/wfs.gdb");

ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute("QuickImport", parameters, trac);

if (resi.Status == esriJobStatus.esriJobSucceeded)
{ }

In the result-window of geoprocessing no new entry was created so I could not look to find the error.

EDIT:

If I remove the "@" in the line parameters.Add(@"WFS,https://www...."); the tool will be started and I see the entry in the results-window. But now the feature-dataset-list is empty. Their definition is in the fdl-file. So I have surely problems with the encoding of this file.

  • Reading this I would say the output geodatabase must not exist, you simply provide a string to a full path? – Hornbydd Oct 23 '18 at 11:49
  • @Hornbydd I thought so and tried import.Output = "C:/temp/wfs.gdb", File doesn't exist but this worked not too. – Ms. Smith Oct 23 '18 at 11:56
  • Next thing I would try is to replace the input dataset with a local shapefile to help confirm that it is not a syntax error but an issue with it being a fws? – Hornbydd Oct 23 '18 at 12:53
  • This doesn't work, because the output has to be a geodatabase, but I found out, problem comes with the first parameter (input dataset). If I only give it "WFS,url" then a toolprocess is started and will be shown in results window... see my next edit – Ms. Smith Oct 23 '18 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.