I am try to export to shapefile with
Hi
if I try to export Attribute Table nothing happens anyone who can help me with this
Dim out_features = "C:\PATH\file.shp"
Dim where_clause = "TYPE = 80"
Dim use_field_alias_as_name = "NOT_USE_ALIAS"
Dim use_Table = "" 'Export Attribute Table
Dim sort_field = "None"
Return Geoprocessing.MakeValueArray(currentLayer, out_features, where_clause,use_Table,use_field_alias_as_name, sort_field)
Protected async Overrides Sub OnClick()
Try
Dim currentLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType(Of FeatureLayer).FirstOrDefault
If currentLayer.ConnectionStatus = ConnectionStatus.Broken Then
End If
If currentLayer.SelectionCount = 0 Then
Else
Dim out_features = "C:\PATH\file.shp"
Dim where_clause = "TYPE = 80"
Dim use_field_alias_as_name = "NOT_USE_ALIAS"
Dim sort_field = "None"
Dim progDlg = New ProgressDialog("Export map" & vbCrLf & "Go get a coffee", "Cancel")
progDlg.Show()
Dim progsrc=New CancelableProgressorSource(progDlg)
Dim outpath = System.IO.Path.GetDirectoryName(out_features)
If Not System.IO.Directory.Exists(outpath) Then System.IO.Directory.CreateDirectory(outpath)
Dim valueArray = Await QueuedTask.Run(Function()
Return Geoprocessing.MakeValueArray(currentLayer, out_features, where_clause, use_field_alias_as_name, sort_field)
End Function)
Dim flags As GPExecuteToolFlags = GPExecuteToolFlags.GPThread
Dim gpResult As IGPResult = Await Geoprocessing.ExecuteToolAsync("conversion.ExportFeatures", valueArray, Nothing, progsrc.CancellationTokenSource.Token, Nothing, flags)
progDlg.Hide()
Dim val = If(String.IsNullOrEmpty(gpResult.ReturnValue), $"Error in gp tool: {gpResult.ErrorMessages}", $"Ok: {gpResult.ReturnValue}")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Thanks
Hi,
You have missed one parameter 'Field Map'. Try to change line 28 like below:
Return Geoprocessing.MakeValueArray(currentLayer, out_features, where_clause)Other values are default and optional
For geoprocessing itself you don't need MCT thread (QueuedTask.Run)