I have series of data in my GDB

I am running the program under VBA and what I want to do is using the data by the tool Kriging.

This is what I thought:

First, Kriging needs data that must be a point shapefile and I am getting the data out of my GDB (one point in one table but there is a lot of data)

  1. I get the data I need and make it in a shapefile
  2. I use the Kriging tool to calculate the shapefile
  3. I use the raster to point tool to change the raster Kriging make to a point layer
  4. I get the point data I want!

Here is my question:

When I get the data from the GDB (using sSQL), how to change it to a shapefile in VBA?

I have only found the page to display XY data using VBA: http://edndoc.esri.com/arcobjects/9.0/samples/tables/create_a_layer_based_on_xy_data.htm but it's can't save as shapefile!

How to save it automatically?

Is there any wrong with my steps?

If need more information please tell me!


An error occurred in the line

gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp__2_


automation error

unspecified error

how to fix it?

Call tools from ArcToolBox in VBA form

in this post about my problem I fix it like follow

gp.Kriging "C:\temp\123.shp", "F30", "C:\AA\Kriging_123", "Spherical 249.101224", "250"

but this time no matter what I try it's doesn't work...

  • the error on the line, gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp_2, was because you need to change the layer sources to your layers. Use the three tools within the VBS code to create your own model in Model Builder. Once you have everything sourced to your layers then you can export the model to a script. You will just have to Dim gp as Object, Dim all your variables as Strings (as I did in my example), and change the, set gp = CreateObject("esriGeoprocessing.GPDispatch.1") line to as it is listed. – artwork21 Jun 13 '11 at 15:48

Since all your tasks are geoprocessing tasks you could just create a model and export out the model to either a vb, python, or jscript. Below is an example of a vbs script. You can then call the script with a macro or UI Control.

Dim gp As object

' Create the Geoprocessor object
set gp = CreateObject("esriGeoprocessing.GPDispatch.1")

' Check out any necessary licenses
gp.CheckOutExtension "spatial"

' Load required toolboxes...
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx"
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx"

' Local variables...
Dim Temp As String = "C:\Temp"
Dim point As String = "C:\Temp\New File Geodatabase.gdb\point"
Dim Temp__2_ As String = "C:\Temp"
Dim Kriging_poin1 As String = "C:\Temp\Kriging_poin1"
Dim Output_variance_of_prediction_raster As String = ""
Dim points_shp As String = "C:\Temp\points.shp"
Dim RasterT_kriging1_shp As String = "C:\Temp\RasterT_kriging1.shp"
Dim kriging_poin1__2_ As String = "C:\Temp\kriging_poin1"

' Process: Feature Class To Shapefile (multiple)...
gp.FeatureClassToShapefile_conversion "'C:\Temp\New File Geodatabase.gdb\point'", Temp__2_

' Process: Kriging...
gp.Kriging_sa points_shp, "ID", Kriging_poin1, "Spherical 51.968339", "51.968339", "VARIABLE 12", Output_variance_of_prediction_raster

' Process: Raster to Point...
gp.RasterToPoint_conversion kriging_poin1__2_, RasterT_kriging1_shp, "Value"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.