in C# or VB.Net how to find lines and points inside or intersecting a polygon

2438
3
07-01-2016 08:04 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

How can I find all points and lines that intersect or are included in a polygon?

I am writing a console application to list pipes and points with a specific criteria inside a polygon.

Thanks

0 Kudos
3 Replies
JeffMatson
Occasional Contributor III
0 Kudos
JoseSanchez
Occasional Contributor III

How do I populate or initialize the envelope with the shape of the current polygon I am selecting.

The goal is to select a polygon and list all points and lines.

// Create the envelope and define its position.

  IEnvelope envelope = new EnvelopeClass();

  envelope.PutCoords(-84.4078, 33.7787, -84.3856, 33.7997);

0 Kudos
JoseSanchez
Occasional Contributor III

How to execute spatial queries

Get the feature and its geometry given an ObjectID.

Dim stateFeature As IFeature = stateFeatureClass.GetFeature(14)

Dim queryGeometry As IGeometry = stateFeature.Shape

' Create the spatial filter; "highwayFeatureClass" is the feature class containing

' the highway data. Set the SubFields property to "FULL_NAME" as only that field

' is shown.

Dim spatialFilter As ISpatialFilter = New SpatialFilterClass()

spatialFilter.Geometry = queryGeometry

spatialFilter.GeometryField = highwayFeatureClass.ShapeFieldName

spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects

spatialFilter.SubFields = "FULL_NAME"

0 Kudos