<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why esriSpatialRelTouches relation does not work? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27412#M729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have two feature layers. The first one is just a polygon and the other one consists of a series of polygons which are enclosed by the first one. Thus, some polygons of the second feature layer touch on the boundaries of the first feauture layer.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So you're saying you have features in one layer that are inside of a feature on another layer?&amp;nbsp; The definition of "touch" is that the geometries only share a boundary.&amp;nbsp; If one geometry is inside another then they cannot touch because their interiors intersect.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2012 12:16:34 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2012-01-30T12:16:34Z</dc:date>
    <item>
      <title>Why esriSpatialRelTouches relation does not work?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27410#M727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have two feature layers. The first one is just a polygon and the other one consists of a series of polygons which are enclosed by the first one. Thus, some polygons of the second feature layer touch on the boundaries of the first feauture layer. I wrotre a code (the basic part shown below to identify which polygons of the second layer touches the boundary of the polygon in the first layer but while the code runs without a problem it does not identify (e.g. by giving FID with Msgbox) any such polygon whilsty it should.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pBlockBoundaryFC&amp;nbsp; As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pBlockBoundaryFC = pBlockBoundary.FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pBlockBoundaryFields&amp;nbsp; As IFields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pBlockBoundaryFields = pBlockBoundaryFC.Fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pGeom As IGeometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pSpatialFilter As ISpatialFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pSpatialFilter = New SpatialFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pBlockBoundaryCursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pBlockBoundaryCursor = pBlockBoundaryFC.Search(pSpatialFilter, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until pBlockBoundaryFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pGeom = pBlockBoundaryFeature.Shape&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; With pSpatialFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set .Geometry = pGeom&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .GeometryField = "Shape"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .SpatialRel = esriSpatialRelTouches&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRelOp As IRelationalOperator&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRelOp = pGeom&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pNewParcelsFeature = pNewParcelsCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until pNewParcelsFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FID = pNewParcelsFeature.Value(intposFID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pRelOp.Touches(pNewParcelsFeature.Shape) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''Report the FID of each parcel that 'touches' the exetrnal boundary&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox FID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pNewParcelsFeature = pNewParcelsCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 06:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27410#M727</guid>
      <dc:creator>DemetrisDemetriou</dc:creator>
      <dc:date>2012-01-30T06:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why esriSpatialRelTouches relation does not work?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27411#M728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Demetris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've restructured your code. Have a look. You should really get into the habit of documenting your code with comments, this is good programing as it allows others to follow the code easier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pBlockBoundaryFC As IFeatureClass
Set pBlockBoundaryFC = pBlockBoundary.FeatureClass
Dim pBlockBoundaryFields As IFields
Set pBlockBoundaryFields = pBlockBoundaryFC.Fields

&lt;SPAN style="color:#008000;"&gt;' Create Spatialfilter
&lt;/SPAN&gt;Dim pGeom As IGeometry
Dim pSpatialFilter As ISpatialFilter
Set pSpatialFilter = New SpatialFilter

&lt;SPAN style="color:#008000;"&gt;' Create a cursor over all BlockBoundary
&lt;/SPAN&gt;Dim pBlockBoundaryCursor As IFeatureCursor
Set pBlockBoundaryCursor = pBlockBoundaryFC.Search(Nothing, False) 

&lt;SPAN style="color:#008000;"&gt;' Main BlockBoundary loop
&lt;/SPAN&gt;Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature
Do Until pBlockBoundaryFeature Is Nothing
 &lt;SPAN style="color:#008000;"&gt;' Get block boundary polygon and update spatialfilter
&lt;/SPAN&gt; Set pGeom = pBlockBoundaryFeature.Shape
 With pSpatialFilter
&amp;nbsp; Set .Geometry = pGeom
&amp;nbsp; .GeometryField = "Shape"
&amp;nbsp; .SpatialRel = esriSpatialRelTouches
 End With
 
 &lt;SPAN style="color:#008000;"&gt;' I am assuming you have a NewParcelFC layer
&lt;/SPAN&gt; set&amp;nbsp; pNewParcelsCursor = pNewParcelFC.Search(pspatialfilter,False)
 Set pNewParcelsFeature = pNewParcelsCursor.NextFeature
 Do Until pNewParcelsFeature Is Nothing
&amp;nbsp; FID = pNewParcelsFeature.Value(intposFID)
&amp;nbsp; MsgBox FID
&amp;nbsp; Set pNewParcelsFeature = pNewParcelsCursor.NextFeature
 loop
 
&lt;SPAN style="color:#008000;"&gt; ' Get next Block boundary
&lt;/SPAN&gt; Set pBlockBoundaryFeature = pBlockBoundaryCursor.NextFeature
Loop
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27411#M728</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-10T21:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why esriSpatialRelTouches relation does not work?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27412#M729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have two feature layers. The first one is just a polygon and the other one consists of a series of polygons which are enclosed by the first one. Thus, some polygons of the second feature layer touch on the boundaries of the first feauture layer.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So you're saying you have features in one layer that are inside of a feature on another layer?&amp;nbsp; The definition of "touch" is that the geometries only share a boundary.&amp;nbsp; If one geometry is inside another then they cannot touch because their interiors intersect.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 12:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27412#M729</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-01-30T12:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why esriSpatialRelTouches relation does not work?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27413#M730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both for the answers. Although I eventually did it with a different way you helped me very much. I eventually used one loop passing the pFeature from another procedures and using the Boundary property of&amp;nbsp; ITopologicalOperator Inteface.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have given points to both of you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 04:51:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-esrispatialreltouches-relation-does-not-work/m-p/27413#M730</guid>
      <dc:creator>DemetrisDemetriou</dc:creator>
      <dc:date>2012-01-31T04:51:29Z</dc:date>
    </item>
  </channel>
</rss>

