I'm using ThinkGeo Mapsuite as a tool for viewing and inputting spatial data into a spatially based numerical model (for grazing simulations). One of my requirements is to query layers to see which polyon (Feature) lies under a point on a predefined grid. We will be doing this for hundreds of thousands of points, so efficient algorithms are important. At the moment, I'm iterating through a predefined grid (say 2000x2000) and calling the following for each grid cell (i.e. 4,000,000 times):
Collection<feature> features = featureLayer.QueryTools.GetFeaturesContaining(gridpoint, ReturningColumnsType.NoColumns);</feature>
Unfortunately, this is very slow.... a more efficient way of dealing with this would be to iterate through each feature (in the ShapeFileFeatureLayer), extract the polygon(s) and then test only those grid cells which lie in the Feature's bounding box. This would require a function like, for example:
if(feature.ContainsPoint(gridpoint))
... but unfortunately, nothing like this exists. Is this something that you could add to the Feature class?? ...or can you suggest a more efficient way of doing this?
I did see a thread on here which mentioned adding the feature layer to the EditInteractiveOverlay class, and then calling CalculateAllControlPoints. This doesn't seem to be a valid option any more - I can't see how we can get a collection of points from this.
Any help would be appreciated.
cheers
David McClymont
DHM Environmental Software Engineering