I apologize in advance that I can't post any of our code. We have an add-in that manages the display of a couple of WMS services. A feature of the add-in is the ability to export the displayed points to a feature class. We accomplish this by running a WFS request; it returns a GeoJSON list of features, which we then write to a new feature class.
The issue is that the user might have tens of thousands of points on the map, and in some cases over 100,000 features. The add-in iterates through this list and adds the features to the feature class one at a time. In the test I ran, it took almost 3 minutes to write about 14,000 features. We were wondering if there's a batch write method somewhere in the SDK, or maybe we incorporate a Python script to do the feature writing.
Solved! Go to Solution.
@TyroneLigon1 , The Insert Cursor API should be used for your level of bulk insertion; it is designed to insert faster rows in the Pro SDK.
Hi,
Have you tried to call geoprocessing tool Batch import data from you add'in? It can import GeoJSON to featureclass.
Can I call the tool via Geoprocessing.ExecuteToolAsync? If so, what is the tool's alias?
Otherwise, will I have to open the tool in the geoprocessing panel? If so, do I have to save the GeoJSON to the file system, then have the user open the file and specify the geodatabase location? Or, can I populate those fields on my own?
Yes, You can call Geoprocessing.ExecuteToolAsync. Tool name will be "BatchImportData_intelligence". You need to have minimum Standard ArcGIS Pro license to use that tool.
Do I first execute Geoprocessing.MakeValueArray with the GeoJSON and the geodatabase location as the arguments? Also, how can I then specify the feature class name? Currently, we first create the feature class in the map project's default geodatabase (the name is a concatenation of a timestamp and WMS layer name), then we add the fields, then we populate the feature class one feature at a time.
Yes, you need to create parameters first:
IReadOnlyList<string> importParams = Geoprocessing.MakeValueArray(@"c:\data\sourcedata", @"\\data\operationaldata.sde", "*airports*.shp", "NO_SUBFOLDERS");
IGPResult result = await Geoprocessing.ExecuteToolAsync("intelligence.BatchImportData", importParams);
if (result.IsFailed)
{
MessageBox.Show("Unable to import", "Batch import");
return;
}
Parameters from documentation sample. Use yours. As I understand featureclass names will be created automatically from source names. After you can rename them.
Can you give me a link to this sample? I can't find it in the Pro SDK documentation.
Link is above. This is python sample at the bottom of page. There is no documentation for each geoprocessing tool for ArcGIS Pro SDK for .NET.
Sorry, I got pulled away from this project for a few days. The parameter array is failing - I believe it's because I'm directly injecting a GeoJSON list object. Do I have to save the list to the file system first?
Yes. Documentation says that first parameter must be file or folder:
Name | Explanation | Data Type |
in_data
[in_data,...]
|
The folders containing the data files or the data files to convert to geodatabase feature classes. |
Folder; File |