how to get the adjacent buildings?

3123
4
09-16-2015 05:13 AM
karthikm
New Contributor

Dear All!...

          I am new for developing arcobjects.I am developing with vb.net.I need to get the adjacent polygons i don't know how to get it.If any one know that please give me the Reference.

Advance Thanks!...

0 Kudos
4 Replies
MahtabAlam1
Occasional Contributor

I think you can use ISpatialFilter ArcObjects Help for .NET developers

First get the geometry of polygon that you want to use to get the adjacent and then use Search on feature class with SpatialRel as esriSpatialRelTouches

HTH

http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//00250000083n000000

karthikm
New Contributor

Dear Alam,

               I See your reference link now i have some idea but not fully understand.I am New from arcgis development  so i need some sample code snippets can you send the sample snippets.

0 Kudos
MahtabAlam1
Occasional Contributor

You can do something like this:

// Create a new spatial filter and use the polygon the geometry    
  ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();
  spatialFilter.Geometry = polyGeom;
  spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelTouches;
  spatialFilter.set_OutputSpatialReference(shapeFieldName, map.SpatialReference);
  spatialFilter.GeometryField = shapeFieldName;


  // Do the search
  ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(spatialFilter, false);

I hope this helps. You might have to show the code you have tried so far to be more specific.

karthikm
New Contributor

Thanks Alam,

                 your Response is very useful but i am using vb.net so i have a small doubt 'what is shapefieldname'?

0 Kudos