Take the 2-minute tour ×
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 creating a buffered geometry around a point feature in order to search for other nearby features. I use the TopologicalOperator to create my buffered geometry. I am attempting to search a feature class when a ComException is thrown telling me that 'the number of points is less than required for feature'. I am unsure whether it is referring to the geometry I am searching with, which I have verified is a polygon with 129 points, or to a feature in the feature class that I am searching within. I have run an ArcObject routine to try and rid the various features classes of features with invalid geometries, but this error persists.

The data's SR is WGS84 with a XY resolution of .000000001. The MXD's projection is Web Mercator Auxiliary Sphere. I am buffering my points by 10 feet. The code works and buffer size work fine in the dev environment but is failing in the test environment.

Spatial Indexes on Search FCs

FC1
1.133126
0.000000
0.000000

FC2
0.310968
0.000000
0.000000

FC3
0.193221
0.000000
0.000000

Snippits of source below. Note that GeoUtil has several methods that will pull values off the ServerContext.

Create Buffered Geometry

private IGeometry GetBufferedGeometry(IFeature feature, int bufferFeet, GeodatabaseUtil geoUtil)
{
    // Convert shape to Map's spatial reference
    var geometry = feature.ShapeCopy;
    geometry.Project(geoUtil.GetMapSpatialReference());

    // Convert buffer feet to Map's distance units
    IUnitConverter converter = new UnitConverterClass();
    var bufferUnits = converter.ConvertUnits(bufferFeet, esriUnits.esriFeet, geoUtil.GetMapDistanceUnits());

    // Buffer shape
    var topoOp = geometry as ITopologicalOperator;
    var bufferedGeometry = topoOp.Buffer(bufferUnits);

    // Project buffered shape back to dataset projection
    bufferedGeometry.Project(feature.Shape.SpatialReference);
    return bufferedGeometry;
}

Search for features

// Create buffered filter
var spatialFilter = geoUtil.NewSpatialFilter();
spatialFilter.Geometry = GetBufferedGeometry(feature, searchBuffer, geoUtil);
spatialFilter.SpatialRel = info.SpatialRelationship;

// Search for features within filter
var featureCursor = searchClass.Search(spatialFilter, true);
var foundFeature = featureCursor.NextFeature();
while (foundFeature != null)
share|improve this question
    
The first thing you might try is not using the geometry variable to represent two different objects. The first being the geometry of the feature, and the 2nd being the geometry of the buffer. I'm not completely sure, but that would at least be something to eliminate as a starting point. –  Get Spatial Aug 27 '12 at 21:22
    
I wonder if the spatial index is too small for the query geometry. Is the buffer very large or something? Also have you tried Simplifying the buffer (set IsKnownSimple to false beforehand)? –  blah238 Aug 27 '12 at 21:23
    
@GetSpatial - I have implemented your change because I agree that it helps readability. However, my problem persists. –  JoeyRobichaud Aug 27 '12 at 21:41
    
@blah238 - I have added additional details to my question. My buffer size is 10 feet and it produces a polygon with 129 points. Where would I set IsKnownSimple to false? The esri help page says that method is read-only on ITopologicalOperator. Does the call to Simplify affect the IsKnownSimple? –  JoeyRobichaud Aug 27 '12 at 21:42
    
In .NET apparently it's IsKnownSimple_2 -- I don't know why. See here: help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/… –  blah238 Aug 27 '12 at 21:55
show 5 more comments

2 Answers

Try using this version of GetBufferedGeometry. I never had to project or change spatial reference before buffering. All should work itself out.

private IGeometry GetBufferedGeometry(IFeature feature, int bufferFeet)
{
    var geometry = feature.ShapeCopy;

    // Buffer shape
    var topoOp = geometry as ITopologicalOperator;
    var bufferedGeometry = topoOp.Buffer(bufferFeet);

    return bufferedGeometry;
}
share|improve this answer
    
Thanks for the suggestion. Since the data is in WGS84 and not State Plane Feet, I would expect the Buffer operation will assume the units are Decimal Degrees. Which would not yield the desired result. –  JoeyRobichaud Feb 12 at 22:44
add comment

A couple of ideas:

what is info.SpatialRelationship set to? Is it something like contains? A point cannot contain a polygon.

I think the buffer distance is so small that when you convert it to decimal degrees the Buffer fails to create a polygon and the geometry collapses to a point? Then potentially your geometry relationship makes no sense. I guess you could test if the buffer has area?

share|improve this answer
add comment

Your Answer

 
discard

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.