eddof13

Create Random Points fails with ERROR 999999: Error executing function.

Discussion created by eddof13 on Mar 16, 2011
Hi,

I am having trouble running some arcobjects code that calls create random points. I would not be doing this in arcobjects, but I am suffering with the same issue using arcpy as seen here: http://forums.arcgis.com/threads/12782-Python-scripting-and-creating-random-points?p=85866&viewfull=1#post85866

Any help as to the cause of this error would be greatly appreciated (Indeed, an official confirmation that create random points is bugged would also be appreciated).

code excerpt:
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.LogHistory = true;

//Input parameters
string constrainingFeatures = "lineRoute";
string outFeatures = "test";
string workspace = "\\\\1.2.3.4\\output\\Routes.gdb";

//Open workspace
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass();
IWorkspace gdb;
try
{
    gdb = workspaceFactory.OpenFromFile(workspace, 0);
}
catch
{
    Console.WriteLine("Unable to open geodatabase");
    return;
}
IFeatureWorkspace fws = (IFeatureWorkspace)gdb;

//Get constraining feature class
IFeatureClass fc = fws.OpenFeatureClass(constrainingFeatures);

//Create random points - DOES NOT WORK WITH A PATH TO WORKSPACE OR the IFeatureWorkspace
//CreateRandomPoints crp = new CreateRandomPoints(fws, outFeatures);
CreateRandomPoints crp = new CreateRandomPoints(workspace, outFeatures);
crp.number_of_points_or_field = "2000";
crp.minimum_allowed_distance = "1 Meter";

//DOES NOT WORK WITH A PATH TO cfc OR the IFeatureClass
//crp.constraining_feature_class = fc;
crp.constraining_feature_class = workspace + "\\" + constrainingFeatures;

//this out_feature_class does not seem to make a difference
crp.out_feature_class = workspace + "\\" + outFeatures;


try
{
    gp.Execute(crp, null);
}


Here is the log:
<ResultViews>
<ResultView Tool="Create Random Points">
<CommandLine>CreateRandomPoints_management \\1.2.3.4\Output\Routes.gdb \\1.2.3.4\Output\Routes.gdb\test \\1.2.3.4\Output\Routes.gdb\lineRoute '0 0 250 250' 2000 '1 Meters' POINT 0</CommandLine>
<ToolSource>C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx\Feature Class\CreateRandomPoints</ToolSource>
<StartTime>Wed Mar 16 14:31:01 2011</StartTime>
<Parameters>
<Inputs>
<Parameter Label="Output Location" Type="Dataset">\\1.2.3.4\Output\Routes.gdb</Parameter>
<Parameter Label="Output Point Feature Class" Type="Scalar">\\1.2.3.4\Output\Routes.gdb\test</Parameter>
<Parameter Label="Constraining Feature Class" Type="Dataset">\\1.2.3.4\Output\Routes.gdb\lineRoute</Parameter>
<Parameter Label="Constraining Extent" Type="Scalar">0 0 250 250</Parameter>
<Parameter Label="Number of Points [value or field]" Type="Scalar">2000</Parameter>
<Parameter Label="Minimum Allowed Distance [value or field]" Type="Scalar">1 Meters</Parameter>
<Parameter Label="Create Multipoint Output" Type="Scalar">false</Parameter>
<Parameter Label="Maximum Number of Points per Multipoint" Type="Scalar">0</Parameter>
</Inputs>
<Outputs>
<Parameter Label="Output Feature Class" Type="Dataset">\\1.2.3.4\Output\Routes.gdb\\\1.2.3.4\Output\Routes.gdb\test</Parameter>
</Outputs>
</Parameters>
<Environments>
<Environment Label="Precision For New Coverages">SINGLE</Environment>
<Environment Label="Auto Commit">1000</Environment>
<Environment Label="Minimize memory use during analysis on terrains">false</Environment>
<Environment Label="Compression">LZ77</Environment>
<Environment Label="Coincident Points">MEAN</Environment>
<Environment Label="Random number generator">0 ACM599</Environment>
<Environment Label="Raster Statistics">STATISTICS 1 1</Environment>
<Environment Label="Level Of Comparison Between Projection Files">NONE</Environment>
<Environment Label="Output has Z Values">Same As Input</Environment>
<Environment Label="Maintain fully qualified field names">true</Environment>
<Environment Label="Tile Size">128 128</Environment>
<Environment Label="Pyramid">PYRAMIDS -1 NEAREST DEFAULT 75</Environment>
<Environment Label="Default TIN storage version">CURRENT</Environment>
<Environment Label="Output Spatial Grid 1">0</Environment>
<Environment Label="Cell Size">MAXOF</Environment>
<Environment Label="Output has M Values">Same As Input</Environment>
<Environment Label="Output Spatial Grid 2">0</Environment>
<Environment Label="Output Spatial Grid 3">0</Environment>
<Environment Label="Maintain Spatial Index">false</Environment>
<Environment Label="Precision For Derived Coverages">HIGHEST</Environment>
</Environments>
<Errors>
<Error>ERROR 999999: Error executing function.</Error>
<Error>Failed to execute (CreateRandomPoints).</Error>
</Errors>
<EndTime>36.00 seconds)</EndTime>
</ResultView>
</ResultViews>


The only other output message is:
Error HRESULT E_FAIL has been returned from a call to a COM component.

Outcomes