Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having trouble running some ArcObjects C# 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:

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:

//ESRI License Initializer generated code.
new esriLicenseProductCode[] { 
esriLicenseProductCode.esriLicenseProductCodeArcInfo }, 
new esriLicenseExtensionCode[] { esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst });
//ESRI License Initializer generated code.

//For some reason the license thing above doesn't always do the job so this is here
IAoInitialize ao = new AoInitialize();

Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
gp.LogHistory = true;

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

//Open workspace
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass();
IWorkspace gdb;
    gdb = workspaceFactory.OpenFromFile(workspace, 0);
    Console.WriteLine("Unable to open geodatabase");
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;

    gp.Execute(crp, null);

Here is the log:

<ResultView Tool="Create Random Points">
<CommandLine>CreateRandomPoints_management \\\Output\Routes.gdb \\\Output\Routes.gdb\test \\\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>
<Parameter Label="Output Location" Type="Dataset">\\\Output\Routes.gdb</Parameter>
<Parameter Label="Output Point Feature Class" Type="Scalar">\\\Output\Routes.gdb\test</Parameter>
<Parameter Label="Constraining Feature Class" Type="Dataset">\\\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>
<Parameter Label="Output Feature Class" Type="Dataset">\\\Output\Routes.gdb\\\\Output\Routes.gdb\test</Parameter>
<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>
<Error>ERROR 999999: Error executing function.</Error>
<Error>Failed to execute (CreateRandomPoints).</Error>
<EndTime>36.00 seconds)</EndTime>

The only other output message is:

Error HRESULT E_FAIL has been returned from a call to a COM component.

I also posted this here:


share|improve this question
Is this a standalone exe? If so are you initializing the license? – Kirk Kuykendall Mar 16 '11 at 20:06
Eddie, are you using 10.0 sp1? I found another bug (crashes when creating large numbers of random points) that was included in sp1. It's not listed in the issues fixed for the patch because it came in as a crash dump report. Um, never mind, as I found NIM061594 (not fixed yet) which appears to be a duplicate of nim064833. – mkennedy Mar 16 '11 at 21:23
Hi, I am using 10.0 sp1. I am also initializing the license (I added the code above). – eddof13 Mar 17 '11 at 13:55

1 Answer 1

In early February, ESRI acknowledged the python part of your question as a bug when I asked for support: [#NIM064833 ArcPy.CreateRandomPoints_management crashes ArcMap when run as a script tool]

I suspect that the same bug is precluding using the tool from ArcObjects.

share|improve this answer
Wouldn't it be nice if ESRI would use a public bug tracker, so we wouldn't have to individually reproduce all this head banging. – Regan Sarwas Mar 16 '11 at 20:04
If you're logged into the Esri website, you can search for bugs. You get the headline and workaround (if any known) only. Admittedly, I had trouble turning up NIM064833 because I didn't search for CreateRandomPoints_management ("Create random points" nor "createrandompoints" didn't turn it up). If you have the nimbus number, you can search those (nim064833). std disclaimer: I work for Esri. – mkennedy Mar 16 '11 at 20:56
@mkennedy, Thanks. I'd searched before, but never found it. Here is more info on Bugs Online. – Regan Sarwas Mar 16 '11 at 21:15
Thanks, I always have trouble finding out if bugs have been confirmed (I usually just post here or on the esri forums and hope for some confirmation). – eddof13 Mar 17 '11 at 14:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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