"Click to Optimize" in IDW with c#

2075
4
Jump to solution
12-15-2013 11:07 PM
VeronikaLem
New Contributor
Does anybody know how can i use function "Click to Optimize" of interpolation IDW in c#?
It exists in simple Geostatistical Analyst Wizard in ArcMap when i choose IDW method of interpolation
0 Kudos
1 Solution

Accepted Solutions
SteveLynch
Esri Regular Contributor
Veronika

You have some typo's in your code. See updated code below.

initialLyr = "galyr" optimizedLyr = "galyr2" optimizedXML = r"c:\temp\outModel.xml" arcpy.IDW_ga("DrawPointsTest","Value1",initialLyr) arcpy.GASetModelParameter_ga(initialLyr, "/model/value[@name='Power']/@auto", "true", optimizedXML) arcpy.GACreateGeostatisticalLayer_ga(optimizedXML ,"DrawPointsTest Value1",optimizedLyr) optimizedPower = arcpy.GAGetModelParameter_ga(optimizedLyr,"/model[@name = 'IDW']/value[@name = 'Power']") print optimizedPower


You only have to run IDW once to create a template geostatistical layer. Any parameter, like neighborhood or power, can then be changed via GASetModelParameter. When this model source is passed into GACreateGeostisticalLayer a new geostatistical layer is created.

Geostatistical Analyst does not have any public API's. However, all geoprocessing tools can be called in C#, see
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/0001000003rr000000.ht...

-Steve

View solution in original post

0 Kudos
4 Replies
VeronikaLem
New Contributor
thank you for yr answer!
i try to use information from second link
1. My code on python:

arcpy.IDW_ga("DrawPointsTest","Value1","galyr")
arcpy.GASetModelParameter_ga("galur", " /model/value[@name='Power']/@auto", "true", "D:/Gis_tests/outModel.xml")
arcpy.GACreateGeostatisticalLayer_ga("galur","DrawPointsTest.shp Value1","OutLayerIDW")


It shows me ERROR 045001: Input dataset(s) error. Table of inputs is not complete.
Why is problem in last line with dataset?

2. How can i use python script in c#? or is other varient?
0 Kudos
SteveLynch
Esri Regular Contributor
Veronika

You have some typo's in your code. See updated code below.

initialLyr = "galyr" optimizedLyr = "galyr2" optimizedXML = r"c:\temp\outModel.xml" arcpy.IDW_ga("DrawPointsTest","Value1",initialLyr) arcpy.GASetModelParameter_ga(initialLyr, "/model/value[@name='Power']/@auto", "true", optimizedXML) arcpy.GACreateGeostatisticalLayer_ga(optimizedXML ,"DrawPointsTest Value1",optimizedLyr) optimizedPower = arcpy.GAGetModelParameter_ga(optimizedLyr,"/model[@name = 'IDW']/value[@name = 'Power']") print optimizedPower


You only have to run IDW once to create a template geostatistical layer. Any parameter, like neighborhood or power, can then be changed via GASetModelParameter. When this model source is passed into GACreateGeostisticalLayer a new geostatistical layer is created.

Geostatistical Analyst does not have any public API's. However, all geoprocessing tools can be called in C#, see
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/0001000003rr000000.ht...

-Steve
0 Kudos
VeronikaLem
New Contributor
Thank you very much for yr help!;)
0 Kudos