cmSelectByPolygon - I have got this working where I can put a polygon around a whole lot of points and then get the data for these points. I was just wondering if there is a way to just loop through the selected points, instead of looping through all the points in the shapefile and testing if it is selected.
For i = 0 To sf.NumShapes - 1
If sf.ShapeSelected(i) = True Then
------Get data from shape
I originally tried to loop through using sf.NumSelected, but the shape index references the shapes in the shapefile and not the selected shapes.
Is there something similar to smSelection and then using SelectByShapeFile and then setting parameter ‘selected only’ to true.
If shpAccidents.SelectByShapefile(shpAreas, tkSpatialRelation.srIntersects, True, selectedShapes) = True Then
cmSelection - I have managed to get all points within a polygon shape by using cmSelection and the above code, but I am struggling to get the points on or very near a line shape. I have tried the following
- Putting a buffer around the line to try and get points that are just off the line
Set sfBuffer = sf.BufferByDistance(100, 1, True, True)
If shpAccidents.SelectByShapefile(sfBuffer, tkSpatialRelation.srIntersects, True, selectedShapes) = True Then —
- If shpAccidents.GetRelatedShapes2(sf.Shape(i), srIntersects, selectedShapes) = True Then —
- I thought of using SelectShapes by using extents with the line shape, but I am not sure if this is the correct way to do this.
I would appreciate any input on what is the best way to do this. In MapObjects, I put a buffer around the line and used this to search for any points within this buffer